From 3d67e677d0522e8f0573c7d35bf72e3742897d2f Mon Sep 17 00:00:00 2001 From: rey256 Date: Tue, 17 Nov 2026 17:31:17 +0300 Subject: [PATCH] Prepare verified laboratory 3 implementation and evidence --- .dockerignore | 3 + .github/pull_request_template.md | 28 +- .gitignore | 4 + Dockerfile | 29 + REPORT.md | 94 +- RUN.md | 97 + backend/.golangci.yaml | 36 + backend/cmd/app/main.go | 133 + backend/codegen.yaml | 13 + backend/db/migrate.go | 25 + backend/db/migrations/00001_core.sql | 44 + backend/db/migrations/00002_idempotency.sql | 12 + backend/db/sqlc/queries/core.sql | 41 + backend/db/sqlc/queries/idempotency.sql | 11 + backend/db/sqlc/sqlc.yaml | 16 + backend/go.mod | 321 ++ backend/go.sum | 1275 +++++++ backend/internal/adapter/handler/api.gen.go | 3223 ++++++++++++++++ backend/internal/adapter/handler/api.go | 102 + backend/internal/adapter/handler/auth.go | 43 + backend/internal/adapter/handler/errors.go | 82 + backend/internal/adapter/handler/gate.go | 78 + backend/internal/adapter/handler/gate_test.go | 102 + backend/internal/adapter/handler/handler.go | 95 + backend/internal/adapter/handler/json.go | 53 + .../internal/adapter/handler/middleware.go | 161 + backend/internal/adapter/handler/stats.go | 47 + backend/internal/adapter/handler/utf8_test.go | 21 + backend/internal/adapter/password/argon.go | 36 + .../repository/postgres/queries/core.sql.go | 347 ++ .../adapter/repository/postgres/queries/db.go | 32 + .../postgres/queries/idempotency.sql.go | 78 + .../repository/postgres/queries/models.go | 55 + .../adapter/repository/postgres/repository.go | 223 ++ backend/internal/application/usecase/auth.go | 86 + .../internal/application/usecase/messenger.go | 102 + backend/internal/config/config.go | 86 + backend/internal/config/config_test.go | 24 + backend/internal/domain/model/chat.go | 52 + backend/internal/domain/model/errors.go | 32 + backend/internal/domain/model/message.go | 51 + backend/internal/domain/model/model_test.go | 126 + backend/internal/domain/model/page.go | 84 + .../domain/model/postgres_text_test.go | 13 + backend/internal/domain/model/text.go | 24 + backend/internal/domain/model/user.go | 34 + backend/internal/domain/port/auth.go | 18 + .../internal/domain/repository/repository.go | 49 + backend/pkg/logger/logger.go | 18 + backend/pkg/server/server.go | 29 + compose.yaml | 75 + config/haproxy.cfg | 27 + deploy/k3s/api.yaml | 70 + deploy/k3s/kustomization.yaml | 9 + deploy/k3s/namespace.yaml | 6 + deploy/k3s/pingap.toml | 20 + deploy/k3s/pingap.yaml | 35 + deploy/k3s/stores.yaml | 96 + docs/archive/compose-report.md | 62 + docs/archive/compose-run.md | 74 + docs/archive/implementation.md | 15 + docs/archive/k3s-migration.md | 36 + evidence/REVIEW.md | 16 + evidence/SOURCE.sha256 | 89 + evidence/acceptance.txt | 1 + evidence/build.txt | 131 + evidence/check.txt | 2 + evidence/compose-check.txt | 0 evidence/failover-1.txt | 4 + evidence/failover-2.txt | 4 + evidence/generate.txt | 0 evidence/go-tests.txt | 13 + evidence/k3s/REVIEW.md | 15 + evidence/k3s/acceptance.txt | 2 + evidence/k3s/contracts.txt | 4 + evidence/k3s/failover-1.txt | 4 + evidence/k3s/failover-2.txt | 4 + evidence/k3s/failover-native-final.txt | 5 + evidence/k3s/persistence.txt | 3 + evidence/k3s/research-json-red.json | 1 + .../k3s/research/run-R4F28Q/fixed-1-8-1.json | 17 + .../k3s/research/run-R4F28Q/fixed-1-8-2.json | 17 + .../k3s/research/run-R4F28Q/fixed-2-8-1.json | 17 + .../k3s/research/run-R4F28Q/fixed-2-8-2.json | 17 + .../k3s/research/run-R4F28Q/fixed-4-8-1.json | 17 + .../k3s/research/run-R4F28Q/fixed-4-8-2.json | 17 + .../research/run-R4F28Q/growing-1-8-1.json | 17 + .../research/run-R4F28Q/growing-1-8-2.json | 17 + .../research/run-R4F28Q/growing-2-8-1.json | 17 + .../research/run-R4F28Q/growing-2-8-2.json | 17 + .../research/run-R4F28Q/growing-4-8-1.json | 17 + .../research/run-R4F28Q/growing-4-8-2.json | 17 + .../k3s/research/run-R4F28Q/hardware.json | 30 + .../k3s/research/run-R4F28Q/pool-1-1-2.json | 17 + .../k3s/research/run-R4F28Q/pool-1-1-3.json | 17 + .../k3s/research/run-R4F28Q/pool-1-8-1.json | 17 + .../k3s/research/run-R4F28Q/pool-1-8-4.json | 17 + evidence/k3s/research/run-R4F28Q/pool.svg | 361 ++ .../k3s/research/run-R4F28Q/replacements.json | 28 + evidence/k3s/research/run-R4F28Q/rolling.json | 17 + evidence/k3s/research/run-R4F28Q/run.json | 1 + evidence/k3s/research/run-R4F28Q/scaling.svg | 695 ++++ evidence/k3s/research/run-R4F28Q/summary.json | 3254 +++++++++++++++++ evidence/k3s/restart-after.json | 35 + evidence/k3s/restart-before.json | 35 + evidence/k3s/restart-postcondition.txt | 1 + evidence/k3s/smoke.txt | 2 + evidence/k3s/stdio-red.txt | 11 + evidence/k3s/stdio.txt | 1 + evidence/k3s/stop-one-after.json | 7 + evidence/k3s/stop-one-before.json | 8 + evidence/k3s/stopped-1-after.json | 7 + evidence/k3s/stopped-1-before.json | 8 + evidence/k3s/stopped-2-after.json | 7 + evidence/k3s/units.txt | 50 + evidence/lint.txt | 1 + evidence/persistence.txt | 3 + evidence/ready-after-persistence.txt | 1 + evidence/ready.txt | 1 + evidence/red-lab3.txt | 1 + evidence/research/run-ImJmOz/fixed-1-8-1.json | 17 + evidence/research/run-ImJmOz/fixed-1-8-2.json | 17 + evidence/research/run-ImJmOz/fixed-2-8-1.json | 17 + evidence/research/run-ImJmOz/fixed-2-8-2.json | 17 + evidence/research/run-ImJmOz/fixed-4-8-1.json | 17 + evidence/research/run-ImJmOz/fixed-4-8-2.json | 17 + .../research/run-ImJmOz/growing-1-8-1.json | 17 + .../research/run-ImJmOz/growing-1-8-2.json | 17 + .../research/run-ImJmOz/growing-2-8-1.json | 17 + .../research/run-ImJmOz/growing-2-8-2.json | 17 + .../research/run-ImJmOz/growing-4-8-1.json | 17 + .../research/run-ImJmOz/growing-4-8-2.json | 17 + evidence/research/run-ImJmOz/hardware.json | 30 + evidence/research/run-ImJmOz/pool-1-1-1.json | 17 + evidence/research/run-ImJmOz/pool-1-1-2.json | 17 + evidence/research/run-ImJmOz/pool-1-8-1.json | 17 + evidence/research/run-ImJmOz/pool-1-8-2.json | 17 + evidence/research/run-ImJmOz/pool.svg | 371 ++ .../research/run-ImJmOz/replacements.json | 12 + evidence/research/run-ImJmOz/rolling.json | 17 + evidence/research/run-ImJmOz/run.json | 1 + evidence/research/run-ImJmOz/scaling.svg | 740 ++++ evidence/research/run-ImJmOz/summary.json | 2725 ++++++++++++++ evidence/research/run-sB0hdP/hardware.json | 30 + evidence/research/run-sB0hdP/pool-1-1-2.json | 17 + evidence/research/run-sB0hdP/pool-1-1-3.json | 17 + evidence/research/run-sB0hdP/pool-1-8-1.json | 17 + evidence/research/run-sB0hdP/pool-1-8-4.json | 17 + evidence/research/run-sB0hdP/run.json | 1 + evidence/research/run-sB0hdP/summary.json | 578 +++ evidence/restart-after.txt | 4 + evidence/restart-before.txt | 4 + evidence/smoke.txt | 2 + evidence/stop-one-after.txt | 1 + evidence/stop-one-before.txt | 1 + evidence/stopped-1.txt | 1 + evidence/stopped-2.txt | 1 + evidence/validate.txt | 2 + evidence/validation-dependencies.txt | 59 + scripts/bootstrap.ts | 22 + scripts/compose.sh | 4 + scripts/k3s-model.ts | 166 + scripts/k3s.ts | 1179 ++++++ scripts/kube.sh | 4 + scripts/restart.sh | 10 + scripts/stop-one.sh | 20 + scripts/up.sh | 4 + student-tests/acceptance.ts | 428 +++ student-tests/k3s-model.test.ts | 288 ++ student-tests/kube-stdin.ts | 32 + student-tests/plot_research.py | 74 + student-tests/requirements-plots.txt | 1 + student-tests/research-compose.ts | 104 + student-tests/research.ts | 374 ++ student-tests/restart-evidence.ts | 22 + student-tests/wait.ts | 14 + 176 files changed, 21076 insertions(+), 38 deletions(-) create mode 100644 Dockerfile create mode 100644 RUN.md create mode 100644 backend/.golangci.yaml create mode 100644 backend/cmd/app/main.go create mode 100644 backend/codegen.yaml create mode 100644 backend/db/migrate.go create mode 100644 backend/db/migrations/00001_core.sql create mode 100644 backend/db/migrations/00002_idempotency.sql create mode 100644 backend/db/sqlc/queries/core.sql create mode 100644 backend/db/sqlc/queries/idempotency.sql create mode 100644 backend/db/sqlc/sqlc.yaml create mode 100644 backend/go.mod create mode 100644 backend/go.sum create mode 100644 backend/internal/adapter/handler/api.gen.go create mode 100644 backend/internal/adapter/handler/api.go create mode 100644 backend/internal/adapter/handler/auth.go create mode 100644 backend/internal/adapter/handler/errors.go create mode 100644 backend/internal/adapter/handler/gate.go create mode 100644 backend/internal/adapter/handler/gate_test.go create mode 100644 backend/internal/adapter/handler/handler.go create mode 100644 backend/internal/adapter/handler/json.go create mode 100644 backend/internal/adapter/handler/middleware.go create mode 100644 backend/internal/adapter/handler/stats.go create mode 100644 backend/internal/adapter/handler/utf8_test.go create mode 100644 backend/internal/adapter/password/argon.go create mode 100644 backend/internal/adapter/repository/postgres/queries/core.sql.go create mode 100644 backend/internal/adapter/repository/postgres/queries/db.go create mode 100644 backend/internal/adapter/repository/postgres/queries/idempotency.sql.go create mode 100644 backend/internal/adapter/repository/postgres/queries/models.go create mode 100644 backend/internal/adapter/repository/postgres/repository.go create mode 100644 backend/internal/application/usecase/auth.go create mode 100644 backend/internal/application/usecase/messenger.go create mode 100644 backend/internal/config/config.go create mode 100644 backend/internal/config/config_test.go create mode 100644 backend/internal/domain/model/chat.go create mode 100644 backend/internal/domain/model/errors.go create mode 100644 backend/internal/domain/model/message.go create mode 100644 backend/internal/domain/model/model_test.go create mode 100644 backend/internal/domain/model/page.go create mode 100644 backend/internal/domain/model/postgres_text_test.go create mode 100644 backend/internal/domain/model/text.go create mode 100644 backend/internal/domain/model/user.go create mode 100644 backend/internal/domain/port/auth.go create mode 100644 backend/internal/domain/repository/repository.go create mode 100644 backend/pkg/logger/logger.go create mode 100644 backend/pkg/server/server.go create mode 100644 compose.yaml create mode 100644 config/haproxy.cfg create mode 100644 deploy/k3s/api.yaml create mode 100644 deploy/k3s/kustomization.yaml create mode 100644 deploy/k3s/namespace.yaml create mode 100644 deploy/k3s/pingap.toml create mode 100644 deploy/k3s/pingap.yaml create mode 100644 deploy/k3s/stores.yaml create mode 100644 docs/archive/compose-report.md create mode 100644 docs/archive/compose-run.md create mode 100644 docs/archive/implementation.md create mode 100644 docs/archive/k3s-migration.md create mode 100644 evidence/REVIEW.md create mode 100644 evidence/SOURCE.sha256 create mode 100644 evidence/acceptance.txt create mode 100644 evidence/build.txt create mode 100644 evidence/check.txt create mode 100644 evidence/compose-check.txt create mode 100644 evidence/failover-1.txt create mode 100644 evidence/failover-2.txt create mode 100644 evidence/generate.txt create mode 100644 evidence/go-tests.txt create mode 100644 evidence/k3s/REVIEW.md create mode 100644 evidence/k3s/acceptance.txt create mode 100644 evidence/k3s/contracts.txt create mode 100644 evidence/k3s/failover-1.txt create mode 100644 evidence/k3s/failover-2.txt create mode 100644 evidence/k3s/failover-native-final.txt create mode 100644 evidence/k3s/persistence.txt create mode 100644 evidence/k3s/research-json-red.json create mode 100644 evidence/k3s/research/run-R4F28Q/fixed-1-8-1.json create mode 100644 evidence/k3s/research/run-R4F28Q/fixed-1-8-2.json create mode 100644 evidence/k3s/research/run-R4F28Q/fixed-2-8-1.json create mode 100644 evidence/k3s/research/run-R4F28Q/fixed-2-8-2.json create mode 100644 evidence/k3s/research/run-R4F28Q/fixed-4-8-1.json create mode 100644 evidence/k3s/research/run-R4F28Q/fixed-4-8-2.json create mode 100644 evidence/k3s/research/run-R4F28Q/growing-1-8-1.json create mode 100644 evidence/k3s/research/run-R4F28Q/growing-1-8-2.json create mode 100644 evidence/k3s/research/run-R4F28Q/growing-2-8-1.json create mode 100644 evidence/k3s/research/run-R4F28Q/growing-2-8-2.json create mode 100644 evidence/k3s/research/run-R4F28Q/growing-4-8-1.json create mode 100644 evidence/k3s/research/run-R4F28Q/growing-4-8-2.json create mode 100644 evidence/k3s/research/run-R4F28Q/hardware.json create mode 100644 evidence/k3s/research/run-R4F28Q/pool-1-1-2.json create mode 100644 evidence/k3s/research/run-R4F28Q/pool-1-1-3.json create mode 100644 evidence/k3s/research/run-R4F28Q/pool-1-8-1.json create mode 100644 evidence/k3s/research/run-R4F28Q/pool-1-8-4.json create mode 100644 evidence/k3s/research/run-R4F28Q/pool.svg create mode 100644 evidence/k3s/research/run-R4F28Q/replacements.json create mode 100644 evidence/k3s/research/run-R4F28Q/rolling.json create mode 100644 evidence/k3s/research/run-R4F28Q/run.json create mode 100644 evidence/k3s/research/run-R4F28Q/scaling.svg create mode 100644 evidence/k3s/research/run-R4F28Q/summary.json create mode 100644 evidence/k3s/restart-after.json create mode 100644 evidence/k3s/restart-before.json create mode 100644 evidence/k3s/restart-postcondition.txt create mode 100644 evidence/k3s/smoke.txt create mode 100644 evidence/k3s/stdio-red.txt create mode 100644 evidence/k3s/stdio.txt create mode 100644 evidence/k3s/stop-one-after.json create mode 100644 evidence/k3s/stop-one-before.json create mode 100644 evidence/k3s/stopped-1-after.json create mode 100644 evidence/k3s/stopped-1-before.json create mode 100644 evidence/k3s/stopped-2-after.json create mode 100644 evidence/k3s/units.txt create mode 100644 evidence/lint.txt create mode 100644 evidence/persistence.txt create mode 100644 evidence/ready-after-persistence.txt create mode 100644 evidence/ready.txt create mode 100644 evidence/red-lab3.txt create mode 100644 evidence/research/run-ImJmOz/fixed-1-8-1.json create mode 100644 evidence/research/run-ImJmOz/fixed-1-8-2.json create mode 100644 evidence/research/run-ImJmOz/fixed-2-8-1.json create mode 100644 evidence/research/run-ImJmOz/fixed-2-8-2.json create mode 100644 evidence/research/run-ImJmOz/fixed-4-8-1.json create mode 100644 evidence/research/run-ImJmOz/fixed-4-8-2.json create mode 100644 evidence/research/run-ImJmOz/growing-1-8-1.json create mode 100644 evidence/research/run-ImJmOz/growing-1-8-2.json create mode 100644 evidence/research/run-ImJmOz/growing-2-8-1.json create mode 100644 evidence/research/run-ImJmOz/growing-2-8-2.json create mode 100644 evidence/research/run-ImJmOz/growing-4-8-1.json create mode 100644 evidence/research/run-ImJmOz/growing-4-8-2.json create mode 100644 evidence/research/run-ImJmOz/hardware.json create mode 100644 evidence/research/run-ImJmOz/pool-1-1-1.json create mode 100644 evidence/research/run-ImJmOz/pool-1-1-2.json create mode 100644 evidence/research/run-ImJmOz/pool-1-8-1.json create mode 100644 evidence/research/run-ImJmOz/pool-1-8-2.json create mode 100644 evidence/research/run-ImJmOz/pool.svg create mode 100644 evidence/research/run-ImJmOz/replacements.json create mode 100644 evidence/research/run-ImJmOz/rolling.json create mode 100644 evidence/research/run-ImJmOz/run.json create mode 100644 evidence/research/run-ImJmOz/scaling.svg create mode 100644 evidence/research/run-ImJmOz/summary.json create mode 100644 evidence/research/run-sB0hdP/hardware.json create mode 100644 evidence/research/run-sB0hdP/pool-1-1-2.json create mode 100644 evidence/research/run-sB0hdP/pool-1-1-3.json create mode 100644 evidence/research/run-sB0hdP/pool-1-8-1.json create mode 100644 evidence/research/run-sB0hdP/pool-1-8-4.json create mode 100644 evidence/research/run-sB0hdP/run.json create mode 100644 evidence/research/run-sB0hdP/summary.json create mode 100644 evidence/restart-after.txt create mode 100644 evidence/restart-before.txt create mode 100644 evidence/smoke.txt create mode 100644 evidence/stop-one-after.txt create mode 100644 evidence/stop-one-before.txt create mode 100644 evidence/stopped-1.txt create mode 100644 evidence/stopped-2.txt create mode 100644 evidence/validate.txt create mode 100644 evidence/validation-dependencies.txt create mode 100644 scripts/bootstrap.ts create mode 100755 scripts/compose.sh create mode 100644 scripts/k3s-model.ts create mode 100644 scripts/k3s.ts create mode 100755 scripts/kube.sh create mode 100755 scripts/restart.sh create mode 100755 scripts/stop-one.sh create mode 100755 scripts/up.sh create mode 100644 student-tests/acceptance.ts create mode 100644 student-tests/k3s-model.test.ts create mode 100644 student-tests/kube-stdin.ts create mode 100644 student-tests/plot_research.py create mode 100644 student-tests/requirements-plots.txt create mode 100644 student-tests/research-compose.ts create mode 100644 student-tests/research.ts create mode 100644 student-tests/restart-evidence.ts create mode 100644 student-tests/wait.ts diff --git a/.dockerignore b/.dockerignore index bc16e556..202e92fc 100644 --- a/.dockerignore +++ b/.dockerignore @@ -18,3 +18,6 @@ __pycache__ node_modules evidence .DS_Store +.stress +student-tests +.local/ diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index e6e63eb2..e47fb13a 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,18 +1,18 @@ ## Лабораторная 3 -Автор / группа: TODO -Целевая оценка (3/4/5): TODO -Трек 5, если заявлен: TODO +Автор / группа: Медведев Андрей Михайлович, БПИ2303 +Целевая оценка (3/4/5): 5 +Трек 5: 1 «Цена масштабирования» -Что реализовано и что перенесено: TODO -Команды запуска из чистого clone: TODO -Результаты проверок и ссылка на REPORT.md: TODO -Ограничения / известные ошибки: TODO -Источники и использование ИИ: TODO +Что реализовано и что перенесено: Две API на k3s за Pingap, общие сессии и транзакционная идемпотентность. Выполнены 16 измерений 1/2/4 реплик и пула, построены графики и проверен rollout под нагрузкой. При том же суммарном бюджете две API дали меньший p95, чем четыре; уменьшение пула не подтвердило улучшение. Собственный Go core перенесён из предыдущей лабы с объявленными изменениями API. +Команды запуска из чистого clone: RUN.md, начиная с bun --no-env-file scripts/k3s.ts up. +Результаты проверок и ссылка на REPORT.md: REPORT.md; фактический вывод в evidence/, хеши проверенных исходников в evidence/SOURCE.sha256. +Ограничения / известные ошибки: один host и общие зависимости; ограничения измерений и сценариев перечислены в REPORT.md. +Источники и использование ИИ: оригинальный skeleton и собственная предыдущая работа; Codex использован для кода, тестов и отчёта. Независимый review native runtime сохранён в evidence/k3s/REVIEW.md; прежний backend review — в evidence/REVIEW.md. -- [ ] Весь обязательный минимум текущей и предыдущих работ сохранён с объявленными переходами. -- [ ] Контракт и публичные тесты не ослаблены. -- [ ] make check и make test выполнены; приложен реальный вывод. -- [ ] Сценарии отказов/безопасности своего уровня воспроизведены. -- [ ] Все секреты и приватные ключи находятся вне Git; отчёт не содержит tokens. -- [ ] README задания сохранён, REPORT.md содержит инструкцию именно моего решения. +- [x] Весь обязательный минимум текущей и предыдущих работ сохранён с объявленными переходами; native эксперименты и ограничения описаны в REPORT.md. +- [x] Контракт и публичные тесты не ослаблены. +- [x] make check и make test выполнены; приложен реальный вывод. +- [x] Сценарии отказов/безопасности своего уровня воспроизведены. +- [x] Все секреты и приватные ключи находятся вне Git; отчёт не содержит tokens. +- [x] README задания сохранён, REPORT.md и RUN.md описывают моё решение. diff --git a/.gitignore b/.gitignore index b5a71896..decc2478 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,7 @@ coverage/ .vscode/ # Keep small, sanitized evidence summaries in evidence/ under version control. # Inspect git diff --cached: ignore rules are not a secret scanner. +.stress +.trash-1792138598/ + +.local/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..e2f52e42 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# syntax=docker/dockerfile:1 + +# Сборка: тег и digest закреплены, модули строго по go.sum (-mod=readonly). +# Вместо слоя `go mod download` — cache mount: go.mod объявляет ещё и dev- +# инструменты (oapi-codegen, golangci-lint), а `go mod download` тянул бы их +# в образ сборки; `go build` скачивает только то, что нужно бинарнику. +FROM golang:1.27.2-alpine@sha256:f92b6ef800e499660581efdabdf25d9d817a9d124eaf900924f0504e7e27e12d AS build +WORKDIR /src +ENV CGO_ENABLED=0 GOFLAGS=-mod=readonly +COPY backend/ ./ +RUN --mount=type=cache,target=/go/pkg/mod \ + --mount=type=cache,target=/root/.cache/go-build \ + go build -trimpath -ldflags='-s -w' -o /out/messenger ./cmd/app + +# Runtime: только статический бинарник, без shell и пакетного менеджера, +# пользователь nonroot (uid 65532). +FROM gcr.io/distroless/static-debian13:nonroot@sha256:e2e927ec666bae08560abb3c55d0659eceabb657f56b6782ab500a9fc7f555e3 +COPY --from=build /out/messenger /messenger +USER 65532:65532 +# GOMEMLIMIT рассчитан на запуск с --memory=256m (REPORT.md): GC начинает +# работать активнее до того, как ядро убьёт процесс по OOM. +ENV APP_HOST=0.0.0.0 APP_PORT=8080 GOMEMLIMIT=200MiB +EXPOSE 8080 +# curl в образе нет: healthcheck — тот же бинарник с флагом. +HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \ + CMD ["/messenger", "-healthcheck"] +STOPSIGNAL SIGTERM +# Exec-форма: сервер — PID 1 и сам получает SIGTERM. +ENTRYPOINT ["/messenger"] diff --git a/REPORT.md b/REPORT.md index c2679005..0984daf6 100644 --- a/REPORT.md +++ b/REPORT.md @@ -1,37 +1,83 @@ -# Отчёт — лабораторная 3 +# Лабораторная 3. k3s, Pingap и взаимозаменяемые API -- Автор, группа: TODO -- Целевая оценка; выбранный трек 5, если нужен: TODO -- Commit/PR: TODO после публикации -- Использованные источники, библиотеки и помощь ИИ: TODO +Автор: Медведев Андрей Михайлович, БПИ2303. Целевая оценка — 5, трек 1 «Цена масштабирования». Основной стенд перенесён на k3s + Pingap по выбору автора. Исходное задание предлагает Compose/Swarm; принятие альтернативы преподавателем не заявляется. Оригинальные README, COURSE, контракты и публичные tests сохранены. -## Запуск из чистого clone +Код, тесты и отчёт подготовлены с помощью Codex. Инструкция запуска — [RUN.md](RUN.md). Исторический вариант Compose/HAProxy описан в [архивном отчёте](docs/archive/compose-report.md); его численные результаты не выдаются за измерения Pingap. -TODO: версии runtime/образов, prerequisites, команды создания локальных secrets/.env, build, миграций, запуска, ожидания готовности, тестов и остановки. Указать необходимые действия оператора. Не вставлять секреты. Отдельно указать безопасную остановку и команду намеренного удаления учебных данных. +## Архитектура и запуск -## Архитектура и решения +Клиент обращается к localhost:28203. Порт ведёт через k3d к Service типа LoadBalancer и Deployment Pingap. Pingap получает адреса API через headless Service с clusterIP: None; отдельный ingress-controller не используется, Traefik выключен при создании кластера. Внешние маршруты находятся в TOML в git и попадают в ConfigMap через Kustomize. -TODO: схема процессов/хранилищ, источник истины, транзакционные границы, ограничения. Что перенесено из lab2, что изменено в этой работе. Соответствие переменных из .env.example реальной конфигурации. +В стенде один server k3s 1.37.1 и две API-реплики. Pingap 0.16.0 и сторонние образы закреплены digest. Собственный образ получает tag из hash Dockerfile и backend. Перед использованием проверяются pinned RepoDigest, соответствие alias и наличие образа в containerd. Экспорт linux/amd64 устраняет ошибку импорта неполного многоплатформенного index Docker29. -## Доказательства критериев +PostgreSQL и Valkey общие для API. Каждая API возвращает реальное имя своего Pod в X-Instance-Id. Сессии проверяются в PostgreSQL при каждом защищённом запросе; Valkey кэширует только неизменяемые профили. Sticky sessions нет. В API нет постоянных пользовательских файлов или локальных сессий. PostgreSQL и Valkey используют PVC; у API нет опубликованного host-порта в обход Pingap. -| Критерий README | Команда/сценарий | Наблюдаемый результат | Файл доказательства | -| --- | --- | --- | --- | -| Публичный smoke | make test | TODO | TODO | -| Остальные пункты уровня 3 | TODO | TODO | TODO | -| Все пункты уровня 4, если заявлен | TODO | TODO | TODO | -| Выбранный трек 5, если заявлен | TODO | TODO | TODO | +Миграции выполняет отдельный Job до запуска API. Readiness PostgreSQL проверяет TCP, затем runner выполняет настоящий SELECT 1: временный сервер инициализации PostgreSQL по Unix-сокету не должен запускать миграции преждевременно. Повторный up сохраняет volumes; произвольные несовместимые миграции под трафиком не заявляются. -TODO: добавить отдельную строку для каждого заявленного критерия. PASS без команды и наблюдения не является доказательством. Проверка инфраструктурного hook требует подтверждения, какие реальные процессы/хранилища перезапущены. +## Общая идемпотентность -## Эксперименты и отказы +Idempotency-Key обязателен для POST сообщения. Его область — пользователь и чат, TTL — 24 часа. PostgreSQL хранит hash семантического payload и ссылку на результат. Резервирование ключа, списание квоты и создание сообщения находятся в одной транзакции. Конкурентные одинаковые запросы получают один Message с 201, другой payload даёт 409; откат не сохраняет сообщение или окончательный результат ключа. -TODO: гипотеза, hardware/лимиты, версии, объём данных, профиль нагрузки, concurrency/arrival rate, длительность/прогрев, повторы, успешные RPS, ошибки, p50/p95/p99, CPU/RAM. Сохранить raw summary без tokens и объяснить ограничения измерения. +Вход Basic разрешён только для создания сессии, бизнес-запросы требуют opaque Bearer. Пароли используют Argon2id, токены — 32 случайных байта с хранением только SHA-256. Logout удаляет persisted session и действует на всех репликах. Пагинация ограничена 100 элементами и использует ключ (created_at,id); это не snapshot конкурентных транзакций. -| Воздействие | Что ожидаем | Что наблюдали | Время восстановления / потеря данных | -| --- | --- | --- | --- | -| TODO | TODO | TODO | TODO | +## Ресурсы, обнаружение и остановка -## Ограничения и следующие шаги +По умолчанию каждая API имеет limit 1 CPU и 512 МиБ, GOMEMLIMIT=400MiB; PostgreSQL — 2 CPU/768 МиБ, Valkey — 0,25 CPU/128 МиБ, Pingap — 0,5 CPU/128 МиБ. K3d server ограничен 8 ГиБ. Пул PostgreSQL API по умолчанию равен 8, одновременно выполняются не более четырёх HTTP-запросов, очередь ограничена 32, ожидание очереди — 1 секунда. Обычный request context равен 5 секундам; SQL connect/statement/lock timeouts — 1/2/1 секундам. -TODO: какие отказы выдерживаются и какие нет; что не реализовано; где учебное упрощение; какое улучшение подтверждено, а какое пока гипотеза. +DNS discovery Pingap обновляется раз в секунду. Активная HTTP-проверка /health/ready имеет частоту 1 секунду и connection/read timeout по 1 секунде. Это настройки обнаружения, а фактическое восстановление проверяется публичным failover-сценарием. При shutdown API предусмотрены preStop 15 секунд и собственный drain до 8 секунд при pod grace 35 секунд. Для Pingap заданы последовательные grace 8 + shutdown 10 секунд при pod grace 25 секунд. + +Аварийный hook scale-down выбирает фактически обслуживший Pod, проверяет UID и нативный container ID и останавливает именно его процесс. CRI inventory подтверждает отсутствие RUNNING-процесса этого Pod UID, включая возможную смену контейнера при устаревшем Pod.status. Hook оставляет одну API-реплику; configure возвращает две. Штатный rollout использует maxSurge=1, maxUnavailable=0 и ждёт завершения старых подов, а не только Deployment Ready. + +## Подтверждённые проверки k3s-варианта + +- Публичный smoke и HTTP acceptance прошли: регистрация, Basic/Bearer, logout, rollback, pagination, конкурентная регистрация, двенадцать одинаковых POST, конфликт payload и одна сессия через разные реальные API. Вывод — evidence/k3s/smoke.txt и acceptance.txt. +- Два публичных failover-сценария подтвердили доступ к данным и отсутствие дублей после остановки разных API-процессов. Pod UID, container ID и survivor записаны отдельно; файлы — evidence/k3s/failover-1.txt, failover-2.txt и stopped-*-after.json. Эти функциональные проверки не используются как бенчмарк пропускной способности host. +- Полный restart API, PostgreSQL, Valkey и Pingap сохранил подтверждённые сообщения и исходный токен. before/after принадлежат одному run_id; отдельная проверка требует замены всех исходных workload Pod UID. Файлы — evidence/k3s/persistence.txt и restart-postcondition.txt. +- Проверка stdin через настоящий scoped wrapper выполнила SELECT в PostgreSQL. Cleanup дополнительно читает нулевое количество собственных пользователей после удаления; пустой stdin и один exit0 psql не считаются успехом. +- Unit-тесты проверяют чужой cluster/context, Namespace UID, partial claim, image identity, target overrides, обходы resource scope, сохранение основной ошибки при teardown и блокировку измерений при активной или неизвестной игре. Формат и lint новых TypeScript helpers проверены отдельно. +- Offline skeleton check и полная OpenAPI validation прошли. Go-код и нормативные контракты при переносе не менялись; его предыдущие race/lint результаты остаются в evidence/ и относятся к тому же backend. + +## Трек 1. Цена масштабирования + +Полная серия k3s/Pingap выполнена на AMD Ryzen 7 5700X, 8 cores/16 threads, Linux x86_64. До и после измерений game-running возвращал ровно 1. Отдельный случайный кластер и его БД принадлежали только эксперименту; после завершения кластер удалён до записи complete summary. Исходные данные — [summary.json](evidence/k3s/research/run-R4F28Q/summary.json), hardware.json и отдельные JSON каждого прогона. + +Профиль — closed-loop POST текстовых сообщений одного отправителя, concurrency 16, длительность 5 секунд, два повтора. БД очищается между прогонами. Перед измерением runner ждёт rollout, удаления terminating Pod и реального DNS/HTTP через Pingap, проверяет число API, limits и pool_max. Генератор создаёт пользователей, сессию и чат до запуска часов; отдельного длительного прогрева нет. После каждого прогона проверяются сохранённые сообщения и неизменность Pod UID. В каждом наборе осталось от 398 до 612 сообщений. + +В серии с постоянным бюджетом суммарные limits API равны 2 CPU/2048 МиБ: одна API получает 2 CPU/2048 МиБ, две — по 1 CPU/1024 МиБ, четыре — по 0,5 CPU/512 МиБ. В растущей серии каждая API получает 1 CPU/512 МиБ: всего 1/2/4 CPU и 512/1024/2048 МиБ. Остальные компоненты не масштабируются. Requests API остаются по 100m CPU/128 МиБ; это одинаковый опыт по суммарным limits, без утверждения о пропорциональных reservations. + +Таблица показывает среднее двух успешных RPS и среднее двух p50/p95/p99; ошибки суммированы. Это средние перцентилей, а не перцентили объединённого распределения. + +| Серия / API | Успешные RPS | p50, мс | p95, мс | p99, мс | Ошибки | +| --- | ---: | ---: | ---: | ---: | ---: | +| Постоянный бюджет / 1 | 117,05 | 133,48 | 175,29 | 204,46 | 0 | +| Постоянный бюджет / 2 | 115,47 | 133,55 | 275,40 | 363,95 | 0 | +| Постоянный бюджет / 4 | 98,08 | 121,03 | 467,08 | 1025,96 | 0 | +| Рост бюджета / 1 | 116,82 | 129,36 | 171,00 | 200,46 | 0 | +| Рост бюджета / 2 | 104,94 | 141,83 | 329,44 | 529,45 | 0 | +| Рост бюджета / 4 | 116,12 | 108,49 | 337,80 | 484,03 | 0 | +| Пул 8 / 1 | 117,10 | 129,32 | 175,24 | 225,22 | 0 | +| Пул 1 / 1 | 113,17 | 133,45 | 187,42 | 279,27 | 0 | + +График [масштабирования](evidence/k3s/research/run-R4F28Q/scaling.svg) показывает средние и диапазоны двух повторов; график [пула](evidence/k3s/research/run-R4F28Q/pool.svg) показывает средние столбцами. Во всех 16 прогонах HTTP-ошибок было ноль. Самый большой наблюдавшийся API cgroup memory.peak — 108,29 МиБ. Summary содержит реальные CPU usage counters и память каждого API, а также десять снимков pg_stat_activity за прогон. CPU counters накопительные; доля загрузки CPU из одного такого снимка не выводится. + +### Насыщение и подтверждённое улучшение + +Рост числа API не дал пропорционального роста throughput. При постоянном бюджете средние RPS равны 117,05 → 115,47 → 98,08; при росте ресурсов — 116,82 → 104,94 → 116,12. Разброс у четырёх API заметен: 77,31–118,84 RPS в постоянном бюджете. Поэтому это наблюдаемое насыщение данного горячего отправителя, а не точный универсальный предел сервера. + +В постоянной серии суммы числа сессий, ожидающих Lock/transactionid, по двадцати снимкам равны 58 → 133 → 244 при 1 → 2 → 4 API; IO/WalSync присутствует в 18/19/20 снимках. Это счётчик наблюдений, а не число уникальных сессий или процент времени. Код CreateMessage в repository.go резервирует idempotency key и вызывает ChargeMessage в одной транзакции; SQL обновляет message_count одной строки users до COMMIT. Такой отправитель сериализует записи по общей строке, а COMMIT ждёт WAL. Эти наблюдения объясняют, почему добавление API не устраняет узкое место PostgreSQL. + +Подтверждённое улучшение для допустимой отказоустойчивой конфигурации — использовать две API вместо четырёх при тех же 2 CPU/2048 МиБ суммарных limits. Средний p95 снизился 467,08 → 275,40 мс, на 41,04%. Оба p95 двух API, 267,10 и 283,71 мс, ниже обоих результатов четырёх API, 342,11 и 592,05 мс. Две реплики сохраняют возможность выдержать проверенный отказ одной API. Средние RPS выросли, но диапазоны перекрываются, поэтому устойчивое улучшение throughput не заявляется. Это экспериментальная конфигурация; обычный запуск по-прежнему даёт двум API по 512 МиБ. + +Отдельная гипотеза уменьшить SQL-пул 8 → 1 проверена в порядке ABBA при одной API и неизменных 2 CPU/2048 МиБ. Она не подтвердилась: средний p95 175,24 → 187,42 мс и RPS 117,10 → 113,17. Настройка pool=1 не объявляется улучшением и не становится default. Отрицательный результат сохранён вместе с остальными данными. + +### Rollout под нагрузкой + +При двух API Deployment заменил обе исходные реплики под непрерывной 30-секундной нагрузкой, concurrency 8, maxSurge=1/maxUnavailable=0. После появления новых UID и завершения старых подов генератор ещё работал, а количество сообщений выросло 39 → 2028. Идентификаторы и счётчики находятся в replacements.json. + +За весь прогон получено 2725 успешных запросов, 0 HTTP-ошибок, 90,61 RPS; p50/p95/p99 равны 58,55/219,17/566,77 мс. Проверена замена подов одного образа, не upgrade с несовместимой миграцией. Нулевые ошибки в этом опыте не являются общим обещанием zero downtime. + +Первый незавершённый запуск был отвергнут из-за многострочного json_agg при разборе метрик. Вывод исправлен приведением к jsonb::text; таблица и графики используют только полностью завершённый run-R4F28Q. Диагностический RED сохранён отдельно в research-json-red.json. + +## Ограничения + +Это один Docker-host и один k3s server. Отказ API-процесса проверен, отказ host, PostgreSQL или единственного входа не покрыт HA. Local-path PVC переживает проверяемый restart, но не заменяет удалённый backup и репликацию. Closed-loop генератор имеет coordinated omission; latency относится к успешным запросам, ошибки считаются отдельно. Переходные ошибки фиксируются, обещания zero downtime нет. diff --git a/RUN.md b/RUN.md new file mode 100644 index 00000000..a3319646 --- /dev/null +++ b/RUN.md @@ -0,0 +1,97 @@ +# Запуск лабораторной 3 на k3s + Pingap + +Автор: Медведев Андрей Михайлович, БПИ2303. Все команды выполняются из корня этой лабы. Исходное задание сохранено в README.md, контракт — в contracts/; описание реализации и результаты находятся в REPORT.md. + +Проверенный host — Linux x86_64 с Docker 29.9.2, k3d 5.9.0, kubectl 1.37.1 и Bun 1.4.4. В кластере используется закреплённый k3s 1.37.1 и Pingap 0.16.0. Для публичных проверок нужен Python 3.9+; для проверок Go и генератора PNG — Go 1.27.2. Большие сборки и эксперименты выполняются на тестовом host, не на Mac. + +## Запуск с нуля + +```sh +bun --no-env-file scripts/k3s.ts up +``` + +Команда создаёт отдельный одноузловой кластер vp-lab3-medvedev, собирает API, проверяет и импортирует образы, создаёт Secrets и PVC, ждёт реального SQL-запроса, выполняет миграции отдельным Job и проверяет HTTP через Pingap. На первом запуске отсутствующие публичные образы скачиваются по закреплённым digest; имеющийся кеш используется повторно. При импорте выбирается linux/amd64, чтобы не переносить отсутствующие части многоплатформенного image index. + +API доступен по http://127.0.0.1:28203. Кластер не меняет глобальный kubeconfig. Его приватный kubeconfig и синтетические credentials находятся в .local/, исключённом из git и Docker context. Повторный запуск сохраняет PVC и данные. + +## Проверки + +```sh +python3 -m venv .venv +.venv/bin/pip install -r requirements-dev.txt +make check PYTHON=.venv/bin/python +make validate PYTHON=.venv/bin/python +make test BASE_URL=http://127.0.0.1:28203 +BASE_URL=http://127.0.0.1:28203 bun --no-env-file student-tests/acceptance.ts +bun --no-env-file student-tests/kube-stdin.ts +bun test student-tests/k3s-model.test.ts +``` + +HTTP acceptance удаляет только собственный случайный набор; публичные проверки сохраняют свои синтетические записи для демонстрации. Проверка stdin действительно выполняет SELECT в PostgreSQL, а не ограничивается exit status процесса psql. + +Остановка обслужившей реплики и её восстановление: + +```sh +make test-failover BASE_URL=http://127.0.0.1:28203 ACTION_SCRIPT=scripts/stop-one.sh +bun --no-env-file scripts/k3s.ts configure +``` + +Повторите обе команды для следующей реплики. TARGET_INSTANCE_ID задаёт публичный тест. Hook проверяет Pod UID, масштабирует API до одной реплики и аварийно останавливает процесс выбранного пода; нативный CRI inventory подтверждает отсутствие работающего процесса с его UID. Свидетельства сохраняются в evidence/k3s/stop-one-before.json и stop-one-after.json. Для штатной замены используется обычный rollout с readiness и preStop, без аварийного kill. + +Полный рестарт компонентов с прежним токеном и данными: + +```sh +make test-persistence BASE_URL=http://127.0.0.1:28203 ACTION_SCRIPT=scripts/restart.sh +``` + +Hook записывает реальные Pod UID до и после рестарта и дожидается API через Pingap. PostgreSQL, Valkey и Pingap входят в сценарий. Проверки backend выполняются отдельно: + +```sh +cd backend +go test -race ./... +go tool golangci-lint run +go generate ./... +``` + +После них вернитесь в корень лабы. Контракты и публичные тесты сохранены, версия OpenAPI не менялась при переносе. + +## Исследование трека 1 + +Запуск на тестовом host с установленным game-running, только без игры: + +```sh +bun --no-env-file student-tests/research.ts +``` + +Runner создаёт отдельный случайный кластер на localhost:28303, проверяет реальные лимиты API и размер SQL-пула, выполняет серии 1/2/4 при постоянном и растущем бюджете, ABBA пула и rollout под непрерывной нагрузкой. Между прогонами очищается только БД этого исследовательского кластера. После проверки кластер удаляется до публикации PASS. + +Отдельный повтор четырёх запусков пула: + +```sh +bun --no-env-file student-tests/research.ts --pool-only +``` + +Новые файлы появляются в evidence/k3s/research/run-*. Графики строятся из summary.json завершённого запуска через student-tests/plot_research.py; dependencies указаны в student-tests/requirements-plots.txt. Результаты старого Compose/HAProxy исследования находятся в историческом отчёте docs/archive/compose-report.md и не являются замерами Pingap. + +Повторное построение графиков из приложенных измерений: + +```sh +.venv/bin/pip install -r student-tests/requirements-plots.txt +.venv/bin/python student-tests/plot_research.py evidence/k3s/research/run-R4F28Q/summary.json +``` + +## Остановка и удаление своего стенда + +Остановка сохраняет кластер и PVC: + +```sh +bun --no-env-file scripts/k3s.ts stop +``` + +Повторный up возвращает сохранённые данные. Полное удаление кластера вместе с его учебными данными выполняется явно из работающего стенда: + +```sh +bun --no-env-file scripts/k3s.ts destroy +``` + +Если кластер был остановлен, сначала выполните up. Runtime проверяет собственный claim, immutable ID server-контейнера и Namespace UID; чужой кластер или заменённый namespace автоматически не принимаются. Оригинальное задание предлагает Compose/Swarm; k3s выбран автором как альтернативный стенд, и принятие этого варианта преподавателем не заявляется. diff --git a/backend/.golangci.yaml b/backend/.golangci.yaml new file mode 100644 index 00000000..8610ae17 --- /dev/null +++ b/backend/.golangci.yaml @@ -0,0 +1,36 @@ +version: "2" +run: + allow-parallel-runners: true +linters: + default: standard + enable: [depguard] + settings: + errcheck: + # Close тела ответа и файла, открытого на чтение: ошибке некуда деться. + exclude-functions: + - (io.ReadCloser).Close + - (*os.File).Close + depguard: + rules: + # Гексагон: ядро и use-case'ы зависят от портов, а не от адаптеров и транспорта. + inner-pure: + files: ["**/internal/domain/**", "**/internal/application/**"] + deny: + - pkg: backend/internal/adapter + desc: домен и приложение зависят от портов, не от адаптеров + - pkg: backend/internal/config + desc: конфиг читает только cmd + - pkg: net/http + desc: HTTP только в adapter/handler + - pkg: github.com/go-chi + desc: роутер только в adapter/handler + - pkg: github.com/rs/zerolog + desc: логирование на границе, в адаптерах + domain-core: + files: ["**/internal/domain/**"] + deny: + - pkg: backend/internal/application + desc: домен не знает о use-case'ах + exclusions: + paths: + - ".*\\.gen\\.go$" diff --git a/backend/cmd/app/main.go b/backend/cmd/app/main.go new file mode 100644 index 00000000..b62a0211 --- /dev/null +++ b/backend/cmd/app/main.go @@ -0,0 +1,133 @@ +package main + +import ( + "context" + "errors" + "flag" + "fmt" + "net/http" + "os" + "os/signal" + "syscall" + "time" + + "backend/db" + "backend/internal/adapter/handler" + "backend/internal/adapter/password" + "backend/internal/adapter/repository/postgres" + "backend/internal/application/usecase" + "backend/internal/config" + "backend/pkg/logger" + "backend/pkg/server" + "github.com/jackc/pgx/v5/pgxpool" + "github.com/redis/go-redis/v9" +) + +func main() { + healthcheck := flag.Bool("healthcheck", false, "проверить /health/ready и выйти (для Docker HEALTHCHECK)") + migrate := flag.Bool("migrate", false, "apply migrations and exit") + flag.Parse() + + cfg, err := config.Load() + if err != nil { + fmt.Fprintln(os.Stderr, "config:", err) + os.Exit(1) + } + if *healthcheck { + os.Exit(probe(cfg.Port)) + } + + log := logger.New(cfg.LogLevel) + dsn, err := config.ReadSecret(cfg.DatabaseURLFile) + if err != nil { + log.Fatal().Msg("database secret unavailable") + } + if *migrate { + if err = db.Migrate(context.Background(), dsn); err != nil { + log.Fatal().Err(err).Msg("migration failed") + } + return + } + pc, err := pgxpool.ParseConfig(dsn) + if err != nil { + log.Fatal().Msg("invalid database configuration") + } + pc.MaxConns = cfg.MaxConns + pc.MinConns = 0 + pc.ConnConfig.ConnectTimeout = time.Second + pc.ConnConfig.RuntimeParams["statement_timeout"] = "2000" + pc.ConnConfig.RuntimeParams["lock_timeout"] = "1000" + pool, err := pgxpool.NewWithConfig(context.Background(), pc) + if err != nil { + log.Fatal().Msg("database initialization failed") + } + defer pool.Close() + var cache *redis.Client + if url, e := config.ReadSecret(cfg.CacheURLFile); e == nil { + opts, e := redis.ParseURL(url) + if e != nil { + log.Fatal().Msg("invalid cache configuration") + } + opts.MaxRetries = 0 + opts.DialTimeout = 80 * time.Millisecond + opts.ReadTimeout = 80 * time.Millisecond + opts.WriteTimeout = 80 * time.Millisecond + cache = redis.NewClient(opts) + defer func() { _ = cache.Close() }() + } + store := postgres.New(pool, cache) + app := usecase.NewMessenger(store) + auth := usecase.NewAuth(store, password.New(), app, time.Duration(cfg.SessionTTLSeconds)*time.Second, time.Now) + h := handler.New(app, auth, pool.Ping, handler.Limits{ + MaxBodyBytes: cfg.MaxBodyBytes, + MaxInflight: cfg.MaxInflight, + MaxQueue: cfg.MaxQueue, + QueueTimeout: cfg.QueueTimeout, + }, func() any { + return map[string]any{"pool_total": pool.Stat().TotalConns(), "pool_acquired": pool.Stat().AcquiredConns(), "pool_max": pool.Stat().MaxConns()} + }, &log) + srv := server.New(cfg.Addr(), h.Router()) + + ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGTERM, syscall.SIGINT) + defer stop() + + serveErr := make(chan error, 1) + go func() { serveErr <- srv.ListenAndServe() }() + log.Info().Str("addr", cfg.Addr()).Str("env", cfg.Env). + Int("max_inflight", cfg.MaxInflight). + Int("max_queue", cfg.MaxQueue).Msg("server started") + + select { + case err := <-serveErr: + log.Fatal().Err(err).Msg("server failed") + case <-ctx.Done(): + } + + started := time.Now() + log.Info().Dur("timeout", cfg.ShutdownTimeout).Msg("shutdown signal received, draining") + h.Drain() + shutdownCtx, cancel := context.WithTimeout(context.Background(), cfg.ShutdownTimeout) + defer cancel() + if err := srv.Shutdown(shutdownCtx); err != nil { + log.Error().Err(err).Msg("shutdown timed out, open requests aborted") + } + if err := <-serveErr; err != nil && !errors.Is(err, http.ErrServerClosed) { + log.Error().Err(err).Msg("server error") + } + log.Info().Dur("took", time.Since(started)).Msg("shutdown complete") +} + +// probe — healthcheck без curl в образе distroless: сам бинарник ходит в +// /health/ready и возвращает код выхода для Docker. +func probe(port int) int { + client := http.Client{Timeout: 2 * time.Second} + resp, err := client.Get(fmt.Sprintf("http://127.0.0.1:%d/health/ready", port)) + if err != nil { + return 1 + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return 1 + } + return 0 +} diff --git a/backend/codegen.yaml b/backend/codegen.yaml new file mode 100644 index 00000000..53d5346b --- /dev/null +++ b/backend/codegen.yaml @@ -0,0 +1,13 @@ +package: handler +generate: + models: true + chi-server: true + strict-server: true +output: api.gen.go +output-options: + # date-time -> handler.Timestamp: ровно 6 цифр дробной части (см. timestamp.go) + type-mapping: + string: + formats: + date-time: + type: Timestamp diff --git a/backend/db/migrate.go b/backend/db/migrate.go new file mode 100644 index 00000000..a228082b --- /dev/null +++ b/backend/db/migrate.go @@ -0,0 +1,25 @@ +package db + +import ( + "context" + "database/sql" + "embed" + _ "github.com/jackc/pgx/v5/stdlib" + "github.com/pressly/goose/v3" +) + +//go:embed migrations/*.sql +var migrations embed.FS + +func Migrate(ctx context.Context, dsn string) error { + conn, err := sql.Open("pgx", dsn) + if err != nil { + return err + } + defer func() { _ = conn.Close() }() + goose.SetBaseFS(migrations) + if err = goose.SetDialect("postgres"); err != nil { + return err + } + return goose.UpContext(ctx, conn, "migrations") +} diff --git a/backend/db/migrations/00001_core.sql b/backend/db/migrations/00001_core.sql new file mode 100644 index 00000000..dd54de73 --- /dev/null +++ b/backend/db/migrations/00001_core.sql @@ -0,0 +1,44 @@ +-- +goose Up +CREATE TABLE users ( + id uuid PRIMARY KEY, + username text NOT NULL UNIQUE CHECK (username ~ '^[a-z0-9_]{3,32}$'), + display_name text NOT NULL CHECK (char_length(display_name) BETWEEN 1 AND 100), + password_hash text NOT NULL, + created_at timestamptz NOT NULL DEFAULT clock_timestamp(), + chat_count integer NOT NULL DEFAULT 0 CHECK (chat_count BETWEEN 0 AND 1000), + message_count integer NOT NULL DEFAULT 0 CHECK (message_count BETWEEN 0 AND 1000000) +); +CREATE TABLE chats ( + id uuid PRIMARY KEY, + title text NOT NULL CHECK (char_length(title) BETWEEN 1 AND 100), + created_at timestamptz NOT NULL DEFAULT clock_timestamp() +); +CREATE TABLE chat_members ( + chat_id uuid NOT NULL REFERENCES chats(id), + user_id uuid NOT NULL REFERENCES users(id), + PRIMARY KEY (chat_id, user_id) +); +CREATE INDEX member_chats ON chat_members(user_id,chat_id); +CREATE INDEX chats_order ON chats(created_at,id); +CREATE TABLE messages ( + id uuid PRIMARY KEY, + chat_id uuid NOT NULL REFERENCES chats(id), + sender_id uuid NOT NULL REFERENCES users(id), + text text NOT NULL CHECK (char_length(text) BETWEEN 1 AND 4000), + created_at timestamptz NOT NULL DEFAULT clock_timestamp(), + FOREIGN KEY (chat_id,sender_id) REFERENCES chat_members(chat_id,user_id) +); +CREATE INDEX messages_history ON messages(chat_id,created_at,id); +CREATE TABLE sessions ( + token_hash text PRIMARY KEY CHECK (length(token_hash)=64), + user_id uuid NOT NULL REFERENCES users(id), + expires_at timestamptz NOT NULL +); +CREATE INDEX sessions_user ON sessions(user_id,expires_at); + +-- +goose Down +DROP TABLE sessions; +DROP TABLE messages; +DROP TABLE chat_members; +DROP TABLE chats; +DROP TABLE users; diff --git a/backend/db/migrations/00002_idempotency.sql b/backend/db/migrations/00002_idempotency.sql new file mode 100644 index 00000000..81c5db25 --- /dev/null +++ b/backend/db/migrations/00002_idempotency.sql @@ -0,0 +1,12 @@ +-- +goose Up +CREATE TABLE idempotency ( + user_id uuid NOT NULL REFERENCES users(id), + chat_id uuid NOT NULL REFERENCES chats(id), + key text NOT NULL CHECK (key ~ '^[A-Za-z0-9._:-]{1,128}$'), + payload_hash text NOT NULL CHECK (length(payload_hash)=64), + message_id uuid NOT NULL REFERENCES messages(id) DEFERRABLE INITIALLY DEFERRED, + expires_at timestamptz NOT NULL, + PRIMARY KEY(user_id,chat_id,key) +); +-- +goose Down +DROP TABLE idempotency; diff --git a/backend/db/sqlc/queries/core.sql b/backend/db/sqlc/queries/core.sql new file mode 100644 index 00000000..9b2e6e7d --- /dev/null +++ b/backend/db/sqlc/queries/core.sql @@ -0,0 +1,41 @@ +-- name: CreateUser :one +INSERT INTO users(id,username,display_name,password_hash) VALUES($1,$2,$3,$4) +RETURNING id,username,display_name,created_at; +-- name: GetUser :one +SELECT id,username,display_name,created_at FROM users WHERE id=$1; +-- name: Credentials :one +SELECT id,password_hash FROM users WHERE username=$1; +-- name: ChargeChat :one +UPDATE users SET chat_count=chat_count+1 WHERE id=$1 AND chat_count<1000 RETURNING id; +-- name: ChargeMessage :one +UPDATE users SET message_count=message_count+1 WHERE id=$1 AND message_count<1000000 RETURNING id; +-- name: InsertChat :one +INSERT INTO chats(id,title) VALUES($1,$2) RETURNING id,title,created_at; +-- name: InsertMembers :exec +INSERT INTO chat_members(chat_id,user_id) SELECT $1,unnest($2::uuid[]); +-- name: GetChat :one +SELECT c.id,c.title,c.created_at,ARRAY(SELECT user_id FROM chat_members WHERE chat_id=c.id ORDER BY user_id)::uuid[] AS members +FROM chats c WHERE c.id=$1; +-- name: ListChats :many +SELECT c.id,c.title,c.created_at,ARRAY(SELECT user_id FROM chat_members WHERE chat_id=c.id ORDER BY user_id)::uuid[] AS members +FROM chats c JOIN chat_members m ON m.chat_id=c.id +WHERE m.user_id=sqlc.arg(member_id) AND (c.created_at,c.id)>(sqlc.arg(after_time)::timestamptz,sqlc.arg(after_id)::uuid) +ORDER BY c.created_at,c.id LIMIT sqlc.arg(page_limit); +-- name: InsertMessage :one +INSERT INTO messages(id,chat_id,sender_id,text) VALUES($1,$2,$3,$4) RETURNING id,chat_id,sender_id,text,created_at; +-- name: ListMessages :many +SELECT id,chat_id,sender_id,text,created_at FROM messages +WHERE chat_id=$1 AND (created_at,id)>(sqlc.arg(after_time)::timestamptz,sqlc.arg(after_id)::uuid) +ORDER BY created_at,id LIMIT sqlc.arg(page_limit); +-- name: LockSessionOwner :one +SELECT id FROM users WHERE id=$1 FOR UPDATE; +-- name: DeleteExpiredSessions :exec +DELETE FROM sessions WHERE user_id=$1 AND expires_at<=clock_timestamp(); +-- name: InsertSession :one +INSERT INTO sessions(token_hash,user_id,expires_at) +SELECT $1,$2,$3 WHERE (SELECT count(*) FROM sessions WHERE user_id=$2)<100 +RETURNING user_id; +-- name: AuthenticateSession :one +SELECT user_id FROM sessions WHERE token_hash=$1 AND expires_at>clock_timestamp(); +-- name: RevokeSession :exec +DELETE FROM sessions WHERE token_hash=$1; diff --git a/backend/db/sqlc/queries/idempotency.sql b/backend/db/sqlc/queries/idempotency.sql new file mode 100644 index 00000000..1eb902e9 --- /dev/null +++ b/backend/db/sqlc/queries/idempotency.sql @@ -0,0 +1,11 @@ +-- name: ReserveKey :one +INSERT INTO idempotency(user_id,chat_id,key,payload_hash,message_id,expires_at) +VALUES($1,$2,$3,$4,$5,clock_timestamp()+interval '24 hours') +ON CONFLICT(user_id,chat_id,key) DO UPDATE SET payload_hash=excluded.payload_hash, +message_id=excluded.message_id,expires_at=excluded.expires_at +WHERE idempotency.expires_at<=clock_timestamp() +RETURNING message_id; +-- name: ReplayMessage :one +SELECT m.id,m.chat_id,m.sender_id,m.text,m.created_at,i.payload_hash +FROM idempotency i JOIN messages m ON m.id=i.message_id +WHERE i.user_id=$1 AND i.chat_id=$2 AND i.key=$3; diff --git a/backend/db/sqlc/sqlc.yaml b/backend/db/sqlc/sqlc.yaml new file mode 100644 index 00000000..168d2e52 --- /dev/null +++ b/backend/db/sqlc/sqlc.yaml @@ -0,0 +1,16 @@ +version: '2' +sql: + - schema: ../migrations + queries: queries + engine: postgresql + gen: + go: + package: queries + out: ../../internal/adapter/repository/postgres/queries + sql_package: pgx/v5 + emit_empty_slices: true + overrides: + - db_type: uuid + go_type: github.com/google/uuid.UUID + - db_type: timestamptz + go_type: time.Time diff --git a/backend/go.mod b/backend/go.mod new file mode 100644 index 00000000..997261cf --- /dev/null +++ b/backend/go.mod @@ -0,0 +1,321 @@ +module backend + +go 1.27.2 + +tool ( + github.com/golangci/golangci-lint/v2/cmd/golangci-lint + github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen + github.com/pressly/goose/v3/cmd/goose + github.com/sqlc-dev/sqlc/cmd/sqlc +) + +require ( + github.com/go-chi/chi/v5 v5.5.0 + github.com/google/uuid v1.6.0 + github.com/oapi-codegen/runtime v1.7.0 + github.com/rs/zerolog v1.35.1 + github.com/spf13/viper v1.21.0 +) + +require ( + 4d63.com/gocheckcompilerdirectives v1.4.0 // indirect + 4d63.com/gochecknoglobals v0.2.2 // indirect + cel.dev/expr v0.25.3 // indirect + charm.land/lipgloss/v2 v2.0.6 // indirect + codeberg.org/chavacava/garif v0.2.1 // indirect + codeberg.org/polyfloyd/go-errorlint v1.9.0 // indirect + dev.gaijin.team/go/exhaustruct/v4 v4.0.0 // indirect + dev.gaijin.team/go/exhaustruct/v5 v5.2.0 // indirect + dev.gaijin.team/go/golib v0.8.1 // indirect + filippo.io/edwards25519 v1.2.0 // indirect + github.com/4meepo/tagalign v1.4.4 // indirect + github.com/Abirdcfly/dupword v0.1.8 // indirect + github.com/AdminBenni/iota-mixing v1.0.0 // indirect + github.com/AlwxSin/noinlineerr v1.0.6 // indirect + github.com/Antonboom/errname v1.1.2 // indirect + github.com/Antonboom/nilnil v1.1.2 // indirect + github.com/Antonboom/testifylint v1.6.4 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.24.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.15.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.13.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.10.1 // indirect + github.com/BurntSushi/toml v1.6.0 // indirect + github.com/ClickHouse/ch-go v0.75.0 // indirect + github.com/ClickHouse/clickhouse-go-linter v1.2.1 // indirect + github.com/ClickHouse/clickhouse-go/v2 v2.51.0 // indirect + github.com/Djarvur/go-err113 v0.1.1 // indirect + github.com/Masterminds/semver/v3 v3.5.0 // indirect + github.com/MirrexOne/unqueryvet v1.5.4 // indirect + github.com/OpenPeeDeeP/depguard/v2 v2.2.1 // indirect + github.com/alecthomas/chroma/v2 v2.27.0 // indirect + github.com/alecthomas/go-check-sumtype v0.5.1-0.20260828200218-ae6904d28606 // indirect + github.com/alexkohler/nakedret/v2 v2.0.6 // indirect + github.com/alexkohler/prealloc v1.1.0 // indirect + github.com/alfatraining/structtag v1.0.0 // indirect + github.com/alingse/asasalint v0.0.11 // indirect + github.com/alingse/nilnesserr v0.2.0 // indirect + github.com/andybalholm/brotli v1.3.0 // indirect + github.com/antlr4-go/antlr/v4 v4.13.1 // indirect + github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect + github.com/ashanbrown/forbidigo/v2 v2.3.1 // indirect + github.com/ashanbrown/makezero/v2 v2.2.1 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/bkielbasa/cyclop v1.2.3 // indirect + github.com/blizzy78/varnamelen v0.8.0 // indirect + github.com/bombsimon/wsl/v4 v4.7.0 // indirect + github.com/bombsimon/wsl/v5 v5.9.0 // indirect + github.com/breml/bidichk v0.3.3 // indirect + github.com/breml/errchkjson v0.4.1 // indirect + github.com/butuzov/ireturn v0.4.1 // indirect + github.com/butuzov/mirror v1.3.3 // indirect + github.com/catenacyber/perfsprint v0.10.1 // indirect + github.com/ccojocar/zxcvbn-go v1.0.4 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/charithe/durationcheck v0.0.11 // indirect + github.com/charmbracelet/colorprofile v0.4.3 // indirect + github.com/charmbracelet/ultraviolet v0.0.0-20260811164956-006e29f97886 // indirect + github.com/charmbracelet/x/ansi v0.11.8 // indirect + github.com/charmbracelet/x/term v0.2.2 // indirect + github.com/charmbracelet/x/termios v0.1.1 // indirect + github.com/charmbracelet/x/windows v0.2.2 // indirect + github.com/ckaznocha/intrange v0.3.1 // indirect + github.com/clipperhouse/displaywidth v0.11.0 // indirect + github.com/clipperhouse/uax29/v2 v2.7.0 // indirect + github.com/coder/websocket v1.8.15 // indirect + github.com/coreos/go-semver v0.3.1 // indirect + github.com/cubicdaiya/gonp v1.0.4 // indirect + github.com/curioswitch/go-reassign v0.3.0 // indirect + github.com/daixiang0/gci v0.13.7 // indirect + github.com/dave/dst v0.27.3 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/denis-tingaikin/go-header v0.5.0 // indirect + github.com/dlclark/regexp2/v2 v2.2.1 // indirect + github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect + github.com/dustin/go-humanize v1.1.0 // indirect + github.com/elastic/go-sysinfo v1.15.5 // indirect + github.com/elastic/go-windows v1.0.2 // indirect + github.com/ettle/strcase v0.2.0 // indirect + github.com/fatih/color v1.19.0 // indirect + github.com/fatih/structtag v1.2.0 // indirect + github.com/firefart/nonamedreturns v1.0.8 // indirect + github.com/fsnotify/fsnotify v1.9.0 // indirect + github.com/fzipp/gocyclo v0.6.0 // indirect + github.com/getkin/kin-openapi v0.142.0 // indirect + github.com/ghostiam/protogetter v1.0.1 // indirect + github.com/go-critic/go-critic v0.15.0 // indirect + github.com/go-faster/city v1.0.1 // indirect + github.com/go-faster/errors v0.8.0 // indirect + github.com/go-openapi/jsonpointer v0.23.1 // indirect + github.com/go-openapi/swag/jsonname v0.26.0 // indirect + github.com/go-sql-driver/mysql v1.10.1 // indirect + github.com/go-toolsmith/astcast v1.1.0 // indirect + github.com/go-toolsmith/astcopy v1.1.0 // indirect + github.com/go-toolsmith/astequal v1.2.0 // indirect + github.com/go-toolsmith/astfmt v1.1.0 // indirect + github.com/go-toolsmith/astp v1.1.0 // indirect + github.com/go-toolsmith/strparse v1.1.0 // indirect + github.com/go-toolsmith/typep v1.1.0 // indirect + github.com/go-viper/mapstructure/v2 v2.5.0 // indirect + github.com/go-xmlfmt/xmlfmt v1.1.3 // indirect + github.com/gobwas/glob v0.2.3 // indirect + github.com/godoc-lint/godoc-lint v0.11.4 // indirect + github.com/gofrs/flock v0.13.1 // indirect + github.com/golang-jwt/jwt/v4 v4.5.2 // indirect + github.com/golang-jwt/jwt/v5 v5.3.1 // indirect + github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect + github.com/golang-sql/sqlexp v0.1.0 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/golangci/asciicheck v0.5.0 // indirect + github.com/golangci/canonicalheader v0.0.0-20260827115959-a25c71c521f6 // indirect + github.com/golangci/dupl v0.0.0-20260401084720-c99c5cf5c202 // indirect + github.com/golangci/go-printf-func-name v0.1.1 // indirect + github.com/golangci/gofmt v0.0.0-20260820135601-e84e05053792 // indirect + github.com/golangci/golangci-lint/v2 v2.14.0 // indirect + github.com/golangci/golines v0.15.0 // indirect + github.com/golangci/misspell v0.8.0 // indirect + github.com/golangci/plugin-module-register v0.1.2 // indirect + github.com/golangci/revgrep v0.8.0 // indirect + github.com/golangci/rowserrcheck v0.0.0-20260419091836-c5f79b8a11ba // indirect + github.com/golangci/swaggoswag v0.0.0-20250504205917-77f2aca3143e // indirect + github.com/golangci/unconvert v0.0.0-20250410112200-a129a6e6413e // indirect + github.com/google/cel-go v0.28.0 // indirect + github.com/google/go-cmp v0.7.0 // indirect + github.com/gordonklaus/ineffassign v0.2.0 // indirect + github.com/gostaticanalysis/analysisutil v0.7.1 // indirect + github.com/gostaticanalysis/comment v1.5.0 // indirect + github.com/gostaticanalysis/forcetypeassert v0.2.0 // indirect + github.com/gostaticanalysis/nilerr v0.1.2 // indirect + github.com/hashicorp/go-immutable-radix/v2 v2.1.0 // indirect + github.com/hashicorp/go-version v1.9.0 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect + github.com/hexops/gotextdiff v1.0.3 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect + github.com/jackc/pgx/v5 v5.13.0 // indirect + github.com/jackc/puddle/v2 v2.2.3 // indirect + github.com/jgautheron/goconst v1.11.0 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jjti/go-spancheck v0.6.5 // indirect + github.com/joho/godotenv v1.5.1 // indirect + github.com/jonboulle/clockwork v0.5.0 // indirect + github.com/julz/importas v0.2.0 // indirect + github.com/karamaru-alpha/copyloopvar v1.2.2 // indirect + github.com/kisielk/errcheck v1.20.0 // indirect + github.com/kkHAIKE/contextcheck v1.1.6 // indirect + github.com/klauspost/compress v1.20.4 // indirect + github.com/kulti/thelper v0.7.1 // indirect + github.com/kunwardeep/paralleltest v1.0.15 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/ldez/exptostd v0.4.5 // indirect + github.com/ldez/gomoddirectives v0.10.0 // indirect + github.com/ldez/grignotin v0.10.1 // indirect + github.com/ldez/structtags v0.6.1 // indirect + github.com/ldez/tagliatelle v0.8.0 // indirect + github.com/ldez/usetesting v0.5.0 // indirect + github.com/leonklingele/grouper v1.1.2 // indirect + github.com/lucasb-eyer/go-colorful v1.4.1 // indirect + github.com/macabu/inamedparam v0.2.0 // indirect + github.com/manuelarte/embeddedstructfieldcheck v0.4.0 // indirect + github.com/manuelarte/funcorder v0.6.0 // indirect + github.com/maratori/testableexamples v1.0.1 // indirect + github.com/maratori/testpackage v1.1.2 // indirect + github.com/matoous/godox v1.1.0 // indirect + github.com/mattn/go-colorable v0.1.15 // indirect + github.com/mattn/go-isatty v0.0.24 // indirect + github.com/mattn/go-runewidth v0.0.24 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/mfridman/interpolate v0.0.2 // indirect + github.com/mfridman/xflag v0.1.0 // indirect + github.com/mgechev/revive v1.17.0 // indirect + github.com/microsoft/go-mssqldb v1.11.2 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/moricho/tparallel v0.3.2 // indirect + github.com/muesli/cancelreader v0.2.2 // indirect + github.com/nakabonne/nestif v0.3.1 // indirect + github.com/ncruces/go-sqlite3 v0.32.0 // indirect + github.com/ncruces/go-strftime v1.1.0 // indirect + github.com/ncruces/julianday v1.0.0 // indirect + github.com/nishanths/exhaustive v0.13.0 // indirect + github.com/nishanths/predeclared v0.2.2 // indirect + github.com/nunnatsa/ginkgolinter v0.24.0 // indirect + github.com/oapi-codegen/oapi-codegen/v2 v2.8.0 // indirect + github.com/oasdiff/yaml v0.1.1 // indirect + github.com/oasdiff/yaml3 v0.0.14 // indirect + github.com/paulmach/orb v0.14.0 // indirect + github.com/pelletier/go-toml/v2 v2.4.3 // indirect + github.com/pganalyze/pg_query_go/v6 v6.2.2 // indirect + github.com/pierrec/lz4/v4 v4.1.33 // indirect + github.com/pingcap/errors v0.11.5-0.20250523034308-74f78ae071ee // indirect + github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 // indirect + github.com/pingcap/log v1.1.0 // indirect + github.com/pingcap/tidb/pkg/parser v0.0.0-20260418072757-ce92298d1124 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + github.com/pressly/goose/v3 v3.30.0 // indirect + github.com/prometheus/client_golang v1.12.1 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.32.1 // indirect + github.com/prometheus/procfs v0.23.0 // indirect + github.com/quasilyte/go-ruleguard v0.4.5 // indirect + github.com/quasilyte/go-ruleguard/dsl v0.3.23 // indirect + github.com/quasilyte/gogrep v0.5.0 // indirect + github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect + github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect + github.com/raeperd/recvcheck v0.3.1 // indirect + github.com/redis/go-redis/v9 v9.23.0 // indirect + github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect + github.com/rivo/uniseg v0.4.7 // indirect + github.com/riza-io/grpc-go v0.2.0 // indirect + github.com/rogpeppe/go-internal v1.16.0 // indirect + github.com/ryancurrah/gomodguard v1.4.1 // indirect + github.com/ryancurrah/gomodguard/v2 v2.1.3 // indirect + github.com/ryanrolds/sqlclosecheck v0.6.0 // indirect + github.com/sagikazarmark/locafero v0.11.0 // indirect + github.com/sanposhiho/wastedassign/v2 v2.1.0 // indirect + github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 // indirect + github.com/sashamelentyev/interfacebloat v1.1.0 // indirect + github.com/sashamelentyev/usestdlibvars v1.29.0 // indirect + github.com/securego/gosec/v2 v2.29.0 // indirect + github.com/segmentio/asm v1.2.1 // indirect + github.com/sethvargo/go-retry v0.5.0 // indirect + github.com/shopspring/decimal v1.6.0 // indirect + github.com/sirupsen/logrus v1.10.2 // indirect + github.com/sivchari/containedctx v1.0.3 // indirect + github.com/sonatard/noctx v0.5.1 // indirect + github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect + github.com/sourcegraph/go-diff v0.9.0 // indirect + github.com/speakeasy-api/jsonpath v0.6.3 // indirect + github.com/speakeasy-api/openapi v1.24.0 // indirect + github.com/spf13/afero v1.15.0 // indirect + github.com/spf13/cast v1.10.0 // indirect + github.com/spf13/cobra v1.10.2 // indirect + github.com/spf13/pflag v1.0.10 // indirect + github.com/sqlc-dev/doubleclick v1.0.0 // indirect + github.com/sqlc-dev/sqlc v1.31.1 // indirect + github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect + github.com/stbenjam/no-sprintf-host-port v0.3.1 // indirect + github.com/stretchr/objx v0.5.3 // indirect + github.com/stretchr/testify v1.12.1 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + github.com/tetafro/godot v1.5.6 // indirect + github.com/tetratelabs/wazero v1.11.0 // indirect + github.com/timakin/bodyclose v0.0.0-20260723120731-857993a2939c // indirect + github.com/timonwong/loggercheck v0.12.0 // indirect + github.com/tomarrell/wrapcheck/v2 v2.12.0 // indirect + github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect + github.com/tursodatabase/libsql-client-go v0.0.0-20260528064733-9d5d30a29a60 // indirect + github.com/ultraware/funlen v0.2.0 // indirect + github.com/ultraware/whitespace v0.2.0 // indirect + github.com/uudashr/gocognit v1.2.1 // indirect + github.com/uudashr/iface v1.5.1 // indirect + github.com/vertica/vertica-sql-go v1.3.9 // indirect + github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect + github.com/wasilibs/go-pgquery v0.0.0-20250409022910-10ac41983c07 // indirect + github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 // indirect + github.com/xen0n/gosmopolitan v1.3.0 // indirect + github.com/xo/terminfo v1.0.0 // indirect + github.com/yagipy/maintidx v1.0.0 // indirect + github.com/yandex-cloud/go-genproto v0.137.0 // indirect + github.com/ydb-platform/ydb-go-genproto v0.0.0-20260810123728-f0c151ab31b9 // indirect + github.com/ydb-platform/ydb-go-sdk-auth-environ v0.5.3 // indirect + github.com/ydb-platform/ydb-go-sdk/v3 v3.156.1 // indirect + github.com/ydb-platform/ydb-go-yc v0.12.5 // indirect + github.com/ydb-platform/ydb-go-yc-metadata v0.6.2 // indirect + github.com/yeya24/promlinter v0.3.0 // indirect + github.com/ykadowak/zerologlint v0.1.5 // indirect + github.com/ziutek/mymysql v1.5.4 // indirect + gitlab.com/bosi/decorder v0.4.2 // indirect + go-simpler.org/musttag v0.14.0 // indirect + go-simpler.org/sloglint v0.12.0 // indirect + go.augendre.info/arangolint v0.4.0 // indirect + go.augendre.info/fatcontext v0.10.1 // indirect + go.opentelemetry.io/otel v1.47.0 // indirect + go.opentelemetry.io/otel/trace v1.47.0 // indirect + go.uber.org/atomic v1.12.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.28.0 // indirect + go.yaml.in/yaml/v3 v3.0.6 // indirect + golang.org/x/crypto v0.59.0 // indirect + golang.org/x/exp v0.0.0-20261109185158-a52e3aef5920 // indirect + golang.org/x/exp/typeparams v0.0.0-20260811152304-ee035b5b010f // indirect + golang.org/x/mod v0.42.0 // indirect + golang.org/x/net v0.62.0 // indirect + golang.org/x/sync v0.25.0 // indirect + golang.org/x/sys v0.50.0 // indirect + golang.org/x/text v0.44.0 // indirect + golang.org/x/tools v0.52.1-0.20261106145633-d407941a339a // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20261110000943-09e21b237f2c // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20261110000943-09e21b237f2c // indirect + google.golang.org/grpc v1.85.0 // indirect + google.golang.org/protobuf v1.36.12 // indirect + gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + honnef.co/go/tools v0.8.1 // indirect + howett.net/plist v1.0.1 // indirect + modernc.org/libc v1.80.2 // indirect + modernc.org/mathutil v1.7.1 // indirect + modernc.org/memory v1.12.1 // indirect + modernc.org/sqlite v1.62.0 // indirect + mvdan.cc/gofumpt v0.12.0 // indirect + mvdan.cc/unparam v0.0.0-20260823230713-2fa3d841b0c8 // indirect +) diff --git a/backend/go.sum b/backend/go.sum new file mode 100644 index 00000000..4dc292d6 --- /dev/null +++ b/backend/go.sum @@ -0,0 +1,1275 @@ +4d63.com/gocheckcompilerdirectives v1.4.0 h1:ZLq62rbGWVmQhiZ8kuNVIT/M09xCSTdJz9K3xOdT/CY= +4d63.com/gocheckcompilerdirectives v1.4.0/go.mod h1:9ZOAiMOjqC/nRwci2fcUXVHUNLG/cH6r6rhUh+jTFtQ= +4d63.com/gochecknoglobals v0.2.2 h1:H1vdnwnMaZdQW/N+NrkT1SZMTBmcwHe9Vq8lJcYYTtU= +4d63.com/gochecknoglobals v0.2.2/go.mod h1:lLxwTQjL5eIesRbvnzIP3jZtG140FnTdz+AlMa+ogt0= +cel.dev/expr v0.25.3 h1:A2jO8jwOugrrovveCWfj0KEZOfqiLgAcwjpHPhzIGw0= +cel.dev/expr v0.25.3/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= +charm.land/lipgloss/v2 v2.0.6 h1:EaGKeuA8FvF+v2BT5VmZd2LoYLaMZJXA5n34th8nCIQ= +charm.land/lipgloss/v2 v2.0.6/go.mod h1:ipDDJNSGa1hlwDtSfW1s2/xR8Vdhbut4PXh2zEKZd0Q= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +codeberg.org/chavacava/garif v0.2.1 h1:K9oYxSlvlXrHXyW26Z4q61bTpJDo1wbvXcYKar/F/LM= +codeberg.org/chavacava/garif v0.2.1/go.mod h1:oHnDSmc0f9K1MeE+MQD/yjkiIB5Xsn5y3S9Dg96Xk84= +codeberg.org/polyfloyd/go-errorlint v1.9.0 h1:VkdEEmA1VBpH6ecQoMR4LdphVI3fA4RrCh2an7YmodI= +codeberg.org/polyfloyd/go-errorlint v1.9.0/go.mod h1:GPRRu2LzVijNn4YkrZYJfatQIdS+TrcK8rL5Xs24qw8= +dev.gaijin.team/go/exhaustruct/v4 v4.0.0 h1:873r7aNneqoBB3IaFIzhvt2RFYTuHgmMjoKfwODoI1Y= +dev.gaijin.team/go/exhaustruct/v4 v4.0.0/go.mod h1:aZ/k2o4Y05aMJtiux15x8iXaumE88YdiB0Ai4fXOzPI= +dev.gaijin.team/go/exhaustruct/v5 v5.2.0 h1:HZB49Fshn8qHJCi9VzYtrcnR1jbLteRHXfnQz8Adams= +dev.gaijin.team/go/exhaustruct/v5 v5.2.0/go.mod h1:5IshpqhgGdKIrF8lBmi3M6YKmI7T3hMzAL9nrflko88= +dev.gaijin.team/go/golib v0.8.1 h1:JYju4x9BSo+QD/AYeHULVDcvEhiFg8wOi6pT0IaZF5E= +dev.gaijin.team/go/golib v0.8.1/go.mod h1:c5fu7t1RSGMxSQgcUYO1sODbzsYnOCXJLmHeNG1Eb+0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo= +filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc= +github.com/4meepo/tagalign v1.4.4 h1:052JDGj2pBORc6NkD30dDXpsUpoYszDeUwr9/5YZuVA= +github.com/4meepo/tagalign v1.4.4/go.mod h1:00WwRjiuSbrRJnSVeGWPLp2epS5Q/l4UEy0apLLS37c= +github.com/Abirdcfly/dupword v0.1.8 h1:SrhcUuGsROBuChFxHALRYzyyPODWn9zwghmzPvD9Cd8= +github.com/Abirdcfly/dupword v0.1.8/go.mod h1:XZrhVnI7YGpsTiWZANSQaBJ4QpL/Tq5vIEdKJJAs9WI= +github.com/AdminBenni/iota-mixing v1.0.0 h1:Os6lpjG2dp/AE5fYBPAA1zfa2qMdCAWwPMCgpwKq7wo= +github.com/AdminBenni/iota-mixing v1.0.0/go.mod h1:i4+tpAaB+qMVIV9OK3m4/DAynOd5bQFaOu+2AhtBCNY= +github.com/AlwxSin/noinlineerr v1.0.6 h1:KAvuxunTe9QxvqrFB7nZTdb/7Wzas4AvifslTnG0Ld8= +github.com/AlwxSin/noinlineerr v1.0.6/go.mod h1:+QgkkoYrMH7RHvcdxdlI7vYYEdgeoFOVjU9sUhw/rQc= +github.com/Antonboom/errname v1.1.2 h1:dxwONZJua3VB8Xh/VaCjqAcqF645sWWv7xj26zy7tdQ= +github.com/Antonboom/errname v1.1.2/go.mod h1:YeZIpgLMxT+SNkruGgYkLhzq/9vs3fsolTZegKaKDZI= +github.com/Antonboom/nilnil v1.1.2 h1:aNlFuJhaEseXe4fHO3xbjXlSeEiQVYa2lEkWD2s2hAY= +github.com/Antonboom/nilnil v1.1.2/go.mod h1:0ynwvphOLmAuMwTNDyBnDZmSwZoDpcFXmUHmzoHH2WA= +github.com/Antonboom/testifylint v1.6.4 h1:gs9fUEy+egzxkEbq9P4cpcMB6/G0DYdMeiFS87UiqmQ= +github.com/Antonboom/testifylint v1.6.4/go.mod h1:YO33FROXX2OoUfwjz8g+gUxQXio5i9qpVy7nXGbxDD4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.24.0 h1:5H6YRLGMoC8z5aXpxqcD6FfswI8mwoVNHSecvIoazt4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.24.0/go.mod h1:Sk63W6X/TElfcE2BknMYg0Q9JuCpebgjnHcbs5md4NM= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.15.0 h1:w3gDUJlJ0BfBsHH02DCBDwbkmMSXJqBj6nBOCo9iocY= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.15.0/go.mod h1:7scl8mG/IFLVjJ9ef/ltdND2T1z0CkgVSaQoUxLvmeU= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.13.0 h1:Terj1CMW4+NY5CpWjSRkqLoxh2DkYDdv/FH2z0897Uc= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.13.0/go.mod h1:7Ut2Qw9vcwpLW5Q4MBy43uSxXS7tK2yjs94OJ6j5thE= +github.com/AzureAD/microsoft-authentication-library-for-go v1.10.1 h1:0O6j18nQDoIff6/mtosT5LNU2WehEwp+LqfX6699oqY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.10.1/go.mod h1:xdYAf5bjkOpsd3auA8riiJW4vneBubt9caavL7626jQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk= +github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ClickHouse/ch-go v0.75.0 h1:GZ3gyLVK8VsgU5M3tjXthUqefgNf9dPAfosx1k+EJ0g= +github.com/ClickHouse/ch-go v0.75.0/go.mod h1:ON7yTiWA2F/xQ5cxb7h9ef/nv8ziLNLKTs0B9CDuZsc= +github.com/ClickHouse/clickhouse-go-linter v1.2.1 h1:zGEKIyd5YL08ieWG/LOUmlau2DxbxPVOfAeo+4Jz3ck= +github.com/ClickHouse/clickhouse-go-linter v1.2.1/go.mod h1:pLorS7ffPTfuUV9M0SJgfHA/h/WQPQUk2FWG9x74cQ4= +github.com/ClickHouse/clickhouse-go/v2 v2.51.0 h1:aoTTC+qxKf1O2XojwC5scRtPjJ9JdRJdkLH9aEWWwWc= +github.com/ClickHouse/clickhouse-go/v2 v2.51.0/go.mod h1:GJrhJWhGJY0SoYTmH2eaDf0KuGsYDTo0ya66osesHmk= +github.com/Djarvur/go-err113 v0.1.1 h1:eHfopDqXRwAi+YmCUas75ZE0+hoBHJ2GQNLYRSxao4g= +github.com/Djarvur/go-err113 v0.1.1/go.mod h1:IaWJdYFLg76t2ihfflPZnM1LIQszWOsFDh2hhhAVF6k= +github.com/Masterminds/semver/v3 v3.5.0 h1:kQceYJfbupGfZOKZQg0kou0DgAKhzDg2NZPAwZ/2OOE= +github.com/Masterminds/semver/v3 v3.5.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= +github.com/MirrexOne/unqueryvet v1.5.4 h1:38QOxShO7JmMWT+eCdDMbcUgGCOeJphVkzzRgyLJgsQ= +github.com/MirrexOne/unqueryvet v1.5.4/go.mod h1:fs9Zq6eh1LRIhsDIsxf9PONVUjYdFHdtkHIgZdJnyPU= +github.com/OpenPeeDeeP/depguard/v2 v2.2.1 h1:vckeWVESWp6Qog7UZSARNqfu/cZqvki8zsuj3piCMx4= +github.com/OpenPeeDeeP/depguard/v2 v2.2.1/go.mod h1:q4DKzC4UcVaAvcfd41CZh0PWpGgzrVxUYBlgKNGquUo= +github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= +github.com/alecthomas/chroma/v2 v2.27.0 h1:FodwmyOBgJULFYmDqibcp9pvfDLWdtPRh9v/r5BXYZs= +github.com/alecthomas/chroma/v2 v2.27.0/go.mod h1:NjJ3ciIgrqBNeIkWZ4e46nseoLDslxU1LmfCoL+wcY8= +github.com/alecthomas/go-check-sumtype v0.5.1-0.20260828200218-ae6904d28606 h1:dXPJ+uOJLWb8rjlAuLX7JPiRJtZKw/53Ol+WxdDJ1Eo= +github.com/alecthomas/go-check-sumtype v0.5.1-0.20260828200218-ae6904d28606/go.mod h1:ZH31IJyNpxpStxP2ayCcPQz+3T2G/OnxIQqe4LWvSDw= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/alexkohler/nakedret/v2 v2.0.6 h1:ME3Qef1/KIKr3kWX3nti3hhgNxw6aqN5pZmQiFSsuzQ= +github.com/alexkohler/nakedret/v2 v2.0.6/go.mod h1:l3RKju/IzOMQHmsEvXwkqMDzHHvurNQfAgE1eVmT40Q= +github.com/alexkohler/prealloc v1.1.0 h1:cKGRBqlXw5iyQGLYhrXrDlcHxugXpTq4tQ5c91wkf8M= +github.com/alexkohler/prealloc v1.1.0/go.mod h1:fT39Jge3bQrfA7nPMDngUfvUbQGQeJyGQnR+913SCig= +github.com/alfatraining/structtag v1.0.0 h1:2qmcUqNcCoyVJ0up879K614L9PazjBSFruTB0GOFjCc= +github.com/alfatraining/structtag v1.0.0/go.mod h1:p3Xi5SwzTi+Ryj64DqjLWz7XurHxbGsq6y3ubePJPus= +github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= +github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= +github.com/alingse/nilnesserr v0.2.0 h1:raLem5KG7EFVb4UIDAXgrv3N2JIaffeKNtcEXkEWd/w= +github.com/alingse/nilnesserr v0.2.0/go.mod h1:1xJPrXonEtX7wyTq8Dytns5P2hNzoWymVUIaKm4HNFg= +github.com/andybalholm/brotli v1.3.0 h1:IdkhjSe/+34U+fP7FSR2Q6Poj1hnHUa2GoWmzXJd6qY= +github.com/andybalholm/brotli v1.3.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= +github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= +github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ= +github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk= +github.com/ashanbrown/forbidigo/v2 v2.3.1 h1:KAZijvQ7zeIBKbhikT4jCm0TLYXC4u78bTiLh/8JROI= +github.com/ashanbrown/forbidigo/v2 v2.3.1/go.mod h1:2QDkLTzU6TV937eFROamXrW92M3paehdae4HCDCOZCM= +github.com/ashanbrown/makezero/v2 v2.2.1 h1:A7uU8dgB1PA9aelTxHMfHIQ8Qev8AB3JLxJUBUsejqM= +github.com/ashanbrown/makezero/v2 v2.2.1/go.mod h1:aEGT/9q3S8DHeE57C88z2a6xydvgx8J5hgXIGWgo0MY= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bkielbasa/cyclop v1.2.3 h1:faIVMIGDIANuGPWH031CZJTi2ymOQBULs9H21HSMa5w= +github.com/bkielbasa/cyclop v1.2.3/go.mod h1:kHTwA9Q0uZqOADdupvcFJQtp/ksSnytRMe8ztxG8Fuo= +github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ089M= +github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= +github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= +github.com/bombsimon/wsl/v4 v4.7.0 h1:1Ilm9JBPRczjyUs6hvOPKvd7VL1Q++PL8M0SXBDf+jQ= +github.com/bombsimon/wsl/v4 v4.7.0/go.mod h1:uV/+6BkffuzSAVYD+yGyld1AChO7/EuLrCF/8xTiapg= +github.com/bombsimon/wsl/v5 v5.9.0 h1:WCrgZ7RQnZO5oEwbVTlYgBdU3wL294kR1BSWV8vTfsU= +github.com/bombsimon/wsl/v5 v5.9.0/go.mod h1:kjo4HiAV5FDkHC8/uzJq9mBffEEd6WT/nvN7DoMovDM= +github.com/breml/bidichk v0.3.3 h1:WSM67ztRusf1sMoqH6/c4OBCUlRVTKq+CbSeo0R17sE= +github.com/breml/bidichk v0.3.3/go.mod h1:ISbsut8OnjB367j5NseXEGGgO/th206dVa427kR8YTE= +github.com/breml/errchkjson v0.4.1 h1:keFSS8D7A2T0haP9kzZTi7o26r7kE3vymjZNeNDRDwg= +github.com/breml/errchkjson v0.4.1/go.mod h1:a23OvR6Qvcl7DG/Z4o0el6BRAjKnaReoPQFciAl9U3s= +github.com/butuzov/ireturn v0.4.1 h1:vWb3NO4t77iku/sjCQ/2pHTQeOmxEhjIriJqRLg1Y+I= +github.com/butuzov/ireturn v0.4.1/go.mod h1:q+DXKzTDV5guNuXLnIab9fKXizTn2miZHLhxH7V/GB4= +github.com/butuzov/mirror v1.3.3 h1:v0RsWBhfFc1RQqE/f3sHpSttKDtodFn0gFmtYyD4/hA= +github.com/butuzov/mirror v1.3.3/go.mod h1:h9BzzwYnTiHO0GzgvaTqIg7VSsOUhdIv51cHFFBmX1w= +github.com/catenacyber/perfsprint v0.10.1 h1:u7Riei30bk46XsG8nknMhKLXG9BcXz3+3tl/WpKm0PQ= +github.com/catenacyber/perfsprint v0.10.1/go.mod h1:DJTGsi/Zufpuus6XPGJyKOTMELe347o6akPvWG9Zcsc= +github.com/ccojocar/zxcvbn-go v1.0.4 h1:FWnCIRMXPj43ukfX000kvBZvV6raSxakYr1nzyNrUcc= +github.com/ccojocar/zxcvbn-go v1.0.4/go.mod h1:3GxGX+rHmueTUMvm5ium7irpyjmm7ikxYFOSJB21Das= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/charithe/durationcheck v0.0.11 h1:g1/EX1eIiKS57NTWsYtHDZ/APfeXKhye1DidBcABctk= +github.com/charithe/durationcheck v0.0.11/go.mod h1:x5iZaixRNl8ctbM+3B2RrPG5t856TxRyVQEnbIEM2X4= +github.com/charmbracelet/colorprofile v0.4.3 h1:QPa1IWkYI+AOB+fE+mg/5/4HRMZcaXex9t5KX76i20Q= +github.com/charmbracelet/colorprofile v0.4.3/go.mod h1:/zT4BhpD5aGFpqQQqw7a+VtHCzu+zrQtt1zhMt9mR4Q= +github.com/charmbracelet/ultraviolet v0.0.0-20260811164956-006e29f97886 h1:rdnVWKgJpTVXKuKuJyxDJ+NFJdUaUqGvyGy61OcvlbA= +github.com/charmbracelet/ultraviolet v0.0.0-20260811164956-006e29f97886/go.mod h1:nAw0d9PhFp1qdzi2xhQU5YOu5sVpDIHWlaW2Uz/bCro= +github.com/charmbracelet/x/ansi v0.11.8 h1:JMFwp0CgDC2+jcOB162HH5k7I3FVbgFSMMYg7dSPBQQ= +github.com/charmbracelet/x/ansi v0.11.8/go.mod h1:ZNN+3mXny/516oTQPLMPIBeSINvNJJQ8uQXDgbeJxY0= +github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk= +github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI= +github.com/charmbracelet/x/termios v0.1.1 h1:o3Q2bT8eqzGnGPOYheoYS8eEleT5ZVNYNy8JawjaNZY= +github.com/charmbracelet/x/termios v0.1.1/go.mod h1:rB7fnv1TgOPOyyKRJ9o+AsTU/vK5WHJ2ivHeut/Pcwo= +github.com/charmbracelet/x/windows v0.2.2 h1:IofanmuvaxnKHuV04sC0eBy/smG6kIKrWG2/jYn2GuM= +github.com/charmbracelet/x/windows v0.2.2/go.mod h1:/8XtdKZzedat74NQFn0NGlGL4soHB0YQZrETF96h75k= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/ckaznocha/intrange v0.3.1 h1:j1onQyXvHUsPWujDH6WIjhyH26gkRt/txNlV7LspvJs= +github.com/ckaznocha/intrange v0.3.1/go.mod h1:QVepyz1AkUoFQkpEqksSYpNpUo3c5W7nWh/s6SHIJJk= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/clipperhouse/displaywidth v0.11.0 h1:lBc6kY44VFw+TDx4I8opi/EtL9m20WSEFgwIwO+UVM8= +github.com/clipperhouse/displaywidth v0.11.0/go.mod h1:bkrFNkf81G8HyVqmKGxsPufD3JhNl3dSqnGhOoSD/o0= +github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk= +github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/coder/websocket v1.8.15 h1:6B2JPeOGlpff2Uz6vOEH1Vzpi0iUz20A+lPVhPHtNUA= +github.com/coder/websocket v1.8.15/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg= +github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= +github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/cubicdaiya/gonp v1.0.4 h1:ky2uIAJh81WiLcGKBVD5R7KsM/36W6IqqTy6Bo6rGws= +github.com/cubicdaiya/gonp v1.0.4/go.mod h1:iWGuP/7+JVTn02OWhRemVbMmG1DOUnmrGTYYACpOI0I= +github.com/curioswitch/go-reassign v0.3.0 h1:dh3kpQHuADL3cobV/sSGETA8DOv457dwl+fbBAhrQPs= +github.com/curioswitch/go-reassign v0.3.0/go.mod h1:nApPCCTtqLJN/s8HfItCcKV0jIPwluBOvZP+dsJGA88= +github.com/daixiang0/gci v0.13.7 h1:+0bG5eK9vlI08J+J/NWGbWPTNiXPG4WhNLJOkSxWITQ= +github.com/daixiang0/gci v0.13.7/go.mod h1:812WVN6JLFY9S6Tv76twqmNqevN0pa3SX3nih0brVzQ= +github.com/dave/dst v0.27.3 h1:P1HPoMza3cMEquVf9kKy8yXsFirry4zEnWOdYPOoIzY= +github.com/dave/dst v0.27.3/go.mod h1:jHh6EOibnHgcUW3WjKHisiooEkYwqpHLBSX1iOBhEyc= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/denis-tingaikin/go-header v0.5.0 h1:SRdnP5ZKvcO9KKRP1KJrhFR3RrlGuD+42t4429eC9k8= +github.com/denis-tingaikin/go-header v0.5.0/go.mod h1:mMenU5bWrok6Wl2UsZjy+1okegmwQ3UgWl4V1D8gjlY= +github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo= +github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/dlclark/regexp2 v1.12.0 h1:0j4c5qQmnC6XOWNjP3PIXURXN2gWx76rd3KvgdPkCz8= +github.com/dlclark/regexp2/v2 v2.2.1 h1:mf4KkFUj0gJuarK8P+LgiS+Lit7m9N1yAwEfPbee7R0= +github.com/dlclark/regexp2/v2 v2.2.1/go.mod h1:avUrQvPaLz2DrFNHJF0taWAFFX2C1GMSSoeiqFjcBmU= +github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960/go.mod h1:9HQzr9D/0PGwMEbC3d5AB7oi67+h4TsQqItC1GVYG58= +github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 h1:PRxIJD8XjimM5aTknUK9w6DHLDox2r2M3DI4i2pnd3w= +github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936/go.mod h1:ttYvX5qlB+mlV1okblJqcSMtR4c52UKxDiX9GRBS8+Q= +github.com/dustin/go-humanize v1.1.0 h1:dbKTrvD0klcbBV/h4AWJdMuZogJACoMlvWIWZ5b2xWg= +github.com/dustin/go-humanize v1.1.0/go.mod h1:hc1CvRkJMsgxqjmjMQF3QNRAZBwY8AXBAzKYoSX9sFI= +github.com/elastic/go-sysinfo v1.15.5 h1:fCVUDmjHgljLUQCygherMnsRRJ9AkuAQIywTL7dEH28= +github.com/elastic/go-sysinfo v1.15.5/go.mod h1:ZBVXmqS368dOn/jvijV/zHLfakWTYHBZPk3G244lHrU= +github.com/elastic/go-windows v1.0.2 h1:yoLLsAsV5cfg9FLhZ9EXZ2n2sQFKeDYrHenkcivY4vI= +github.com/elastic/go-windows v1.0.2/go.mod h1:bGcDpBzXgYSqM0Gx3DM4+UxFj300SZLixie9u9ixLM8= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/ettle/strcase v0.2.0 h1:fGNiVF21fHXpX1niBgk0aROov1LagYsOwV/xqKDKR/Q= +github.com/ettle/strcase v0.2.0/go.mod h1:DajmHElDSaX76ITe3/VHVyMin4LWSJN5Z909Wp+ED1A= +github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w= +github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE= +github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= +github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= +github.com/firefart/nonamedreturns v1.0.8 h1:iB32Dl17zJl1zlVEj/WlUWgx0HiRyQ85OUw1WHa4/II= +github.com/firefart/nonamedreturns v1.0.8/go.mod h1:vxFNvm5AfP/8rgAKFzYmnqx0yp1HjrYsErZ9pHPTznA= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= +github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= +github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= +github.com/getkin/kin-openapi v0.142.0 h1:izj0vBdFprMhitfzaX8sTqztsEQyvwhssBoB6n8NO7w= +github.com/getkin/kin-openapi v0.142.0/go.mod h1:3BH9M9XDe/y9M5DSvEocVYAYq1w0qrhJHjC/vZi0AaY= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/ghostiam/protogetter v1.0.1 h1:q4LLTx2KJHJpxrfO3BniUDWoFkoqWD/UlHhClBlUlLM= +github.com/ghostiam/protogetter v1.0.1/go.mod h1:50Fh5yZfs6SFGrd1FlmT04NcguyEOxyjNK5zGD6/EvM= +github.com/go-chi/chi/v5 v5.5.0 h1:xdKQ1dJmVJsmgahrXSKhUx8NyVPzpwdlyrrQFpMPJgg= +github.com/go-chi/chi/v5 v5.5.0/go.mod h1:d1IG7GtKPSjPyBP365PH8sAGVHk3qfB/IhjFNRH1wWM= +github.com/go-critic/go-critic v0.15.0 h1:MDUZIQKytIl+vPEc0Igw51m4uLTdi1ZGz2jatEqNs1g= +github.com/go-critic/go-critic v0.15.0/go.mod h1:3BPrw8nHATGm3o2n37cssOmJzpySGKCdY8JWkCzxgKQ= +github.com/go-faster/city v1.0.1 h1:4WAxSZ3V2Ws4QRDrscLEDcibJY8uf41H6AhXDrNDcGw= +github.com/go-faster/city v1.0.1/go.mod h1:jKcUJId49qdW3L1qKHH/3wPeUstCVpVSXTM6vO3VcTw= +github.com/go-faster/errors v0.8.0 h1:9T9eJrM+72dFk7n4DfhuaDDe6cyuFCSW2oNUkN77Yqc= +github.com/go-faster/errors v0.8.0/go.mod h1:5ySTjWFiphBs07IKuiL69nxdfd5+fzh1u7FPGZP2quo= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-openapi/jsonpointer v0.23.1 h1:1HBACs7XIwR2RcmItfdSFlALhGbe6S92p0ry4d1GWg4= +github.com/go-openapi/jsonpointer v0.23.1/go.mod h1:iWRmZTrGn7XwYhtPt/fvdSFj1OfNBngqRT2UG3BxSqY= +github.com/go-openapi/swag/jsonname v0.26.0 h1:gV1NFX9M8avo0YSpmWogqfQISigCmpaiNci8cGECU5w= +github.com/go-openapi/swag/jsonname v0.26.0/go.mod h1:urBBR8bZNoDYGr653ynhIx+gTeIz0ARZxHkAPktJK2M= +github.com/go-openapi/testify/v2 v2.4.2 h1:tiByHpvE9uHrrKjOszax7ZvKB7QOgizBWGBLuq0ePx4= +github.com/go-openapi/testify/v2 v2.4.2/go.mod h1:SgsVHtfooshd0tublTtJ50FPKhujf47YRqauXXOUxfw= +github.com/go-sql-driver/mysql v1.10.1 h1:arlSnNLq6a5yxGxV7qg9lF4j0C+KwD6NbQyKr9QL6ME= +github.com/go-sql-driver/mysql v1.10.1/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/go-toolsmith/astcast v1.1.0 h1:+JN9xZV1A+Re+95pgnMgDboWNVnIMMQXwfBwLRPgSC8= +github.com/go-toolsmith/astcast v1.1.0/go.mod h1:qdcuFWeGGS2xX5bLM/c3U9lewg7+Zu4mr+xPwZIB4ZU= +github.com/go-toolsmith/astcopy v1.1.0 h1:YGwBN0WM+ekI/6SS6+52zLDEf8Yvp3n2seZITCUBt5s= +github.com/go-toolsmith/astcopy v1.1.0/go.mod h1:hXM6gan18VA1T/daUEHCFcYiW8Ai1tIwIzHY6srfEAw= +github.com/go-toolsmith/astequal v1.0.3/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4= +github.com/go-toolsmith/astequal v1.1.0/go.mod h1:sedf7VIdCL22LD8qIvv7Nn9MuWJruQA/ysswh64lffQ= +github.com/go-toolsmith/astequal v1.2.0 h1:3Fs3CYZ1k9Vo4FzFhwwewC3CHISHDnVUPC4x0bI2+Cw= +github.com/go-toolsmith/astequal v1.2.0/go.mod h1:c8NZ3+kSFtFY/8lPso4v8LuJjdJiUFVnSuU3s0qrrDY= +github.com/go-toolsmith/astfmt v1.1.0 h1:iJVPDPp6/7AaeLJEruMsBUlOYCmvg0MoCfJprsOmcco= +github.com/go-toolsmith/astfmt v1.1.0/go.mod h1:OrcLlRwu0CuiIBp/8b5PYF9ktGVZUjlNMV634mhwuQ4= +github.com/go-toolsmith/astp v1.1.0 h1:dXPuCl6u2llURjdPLLDxJeZInAeZ0/eZwFJmqZMnpQA= +github.com/go-toolsmith/astp v1.1.0/go.mod h1:0T1xFGz9hicKs8Z5MfAqSUitoUYS30pDMsRVIDHs8CA= +github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= +github.com/go-toolsmith/strparse v1.1.0 h1:GAioeZUK9TGxnLS+qfdqNbA4z0SSm5zVNtCQiyP2Bvw= +github.com/go-toolsmith/strparse v1.1.0/go.mod h1:7ksGy58fsaQkGQlY8WVoBFNyEPMGuJin1rfoPS4lBSQ= +github.com/go-toolsmith/typep v1.1.0 h1:fIRYDyF+JywLfqzyhdiHzRop/GQDxxNhLGQ6gFUNHus= +github.com/go-toolsmith/typep v1.1.0/go.mod h1:fVIw+7zjdsMxDA3ITWnH1yOiw1rnTQKCsF/sk2H/qig= +github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= +github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= +github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-xmlfmt/xmlfmt v1.1.3 h1:t8Ey3Uy7jDSEisW2K3somuMKIpzktkWptA0iFCnRUWY= +github.com/go-xmlfmt/xmlfmt v1.1.3/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= +github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/godoc-lint/godoc-lint v0.11.4 h1:N9zUYVJ/OkznBbrBsU/zODvua64EUplMBLQWStO3+1M= +github.com/godoc-lint/godoc-lint v0.11.4/go.mod h1:7usTXoxS0QYIi5usTSCPwR0w/6xLjcz450shXjLn3t4= +github.com/gofrs/flock v0.13.1 h1:jjREztyBeSKBZYAC+mgc1laB+xsgy4kYMf3FbKF2UBo= +github.com/gofrs/flock v0.13.1/go.mod h1:sf4BFiHwnvgxa25DlQoDqXQnwRMEOwqxRq37P6MzzmE= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI= +github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= +github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= +github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golangci/asciicheck v0.5.0 h1:jczN/BorERZwK8oiFBOGvlGPknhvq0bjnysTj4nUfo0= +github.com/golangci/asciicheck v0.5.0/go.mod h1:5RMNAInbNFw2krqN6ibBxN/zfRFa9S6tA1nPdM0l8qQ= +github.com/golangci/canonicalheader v0.0.0-20260827115959-a25c71c521f6 h1:fVLolA3dG6s0brGetsiDAtcnpMSwVa2LqXJEw/9RJG4= +github.com/golangci/canonicalheader v0.0.0-20260827115959-a25c71c521f6/go.mod h1:1xo+NFW5S+bEf2DKXhaxuzvcDN5AR6o/KMwvqC5Mkpo= +github.com/golangci/dupl v0.0.0-20260401084720-c99c5cf5c202 h1:CbTB8KpqnViI6lIXxp03Oclc4VFHi3K4BWC1TacsZ+A= +github.com/golangci/dupl v0.0.0-20260401084720-c99c5cf5c202/go.mod h1:NUw9Zr2Sy7+HxzdjIULge71wI6yEg1lWQr7Evcu8K0E= +github.com/golangci/go-printf-func-name v0.1.1 h1:hIYTFJqAGp1iwoIfsNTpoq1xZAarogrvjO9AfiW3B4U= +github.com/golangci/go-printf-func-name v0.1.1/go.mod h1:Es64MpWEZbh0UBtTAICOZiB+miW53w/K9Or/4QogJss= +github.com/golangci/gofmt v0.0.0-20260820135601-e84e05053792 h1:WL8YKrt3UbOBqSRU7GpP5BTtQTMWtVtj+mfPijgZeIg= +github.com/golangci/gofmt v0.0.0-20260820135601-e84e05053792/go.mod h1:te5hX0dW4C5r6YbXs+6ysNr8Q5UTmdIqGbb+mlFiYmA= +github.com/golangci/golangci-lint/v2 v2.14.0 h1:ot8QffRa4LzAAEgtvNYrVs9esxQ7xoTwoAv6uhp4ngA= +github.com/golangci/golangci-lint/v2 v2.14.0/go.mod h1:amHimCzNDP1GfVno3hIiNssjvqXmuW+CPZAHOdR4cIc= +github.com/golangci/golines v0.15.0 h1:Qnph25g8Y1c5fdo1X7GaRDGgnMHgnxh4Gk4VfPTtRx0= +github.com/golangci/golines v0.15.0/go.mod h1:AZjXd23tbHMpowhtnGlj9KCNsysj72aeZVVHnVcZx10= +github.com/golangci/misspell v0.8.0 h1:qvxQhiE2/5z+BVRo1kwYA8yGz+lOlu5Jfvtx2b04Jbg= +github.com/golangci/misspell v0.8.0/go.mod h1:WZyyI2P3hxPY2UVHs3cS8YcllAeyfquQcKfdeE9AFVg= +github.com/golangci/plugin-module-register v0.1.2 h1:e5WM6PO6NIAEcij3B053CohVp3HIYbzSuP53UAYgOpg= +github.com/golangci/plugin-module-register v0.1.2/go.mod h1:1+QGTsKBvAIvPvoY/os+G5eoqxWn70HYDm2uvUyGuVw= +github.com/golangci/revgrep v0.8.0 h1:EZBctwbVd0aMeRnNUsFogoyayvKHyxlV3CdUA46FX2s= +github.com/golangci/revgrep v0.8.0/go.mod h1:U4R/s9dlXZsg8uJmaR1GrloUr14D7qDl8gi2iPXJH8k= +github.com/golangci/rowserrcheck v0.0.0-20260419091836-c5f79b8a11ba h1:lqtcnSMDuuJdu/LrKWi5RJzpSNLOJXYe/nzQutTI5kg= +github.com/golangci/rowserrcheck v0.0.0-20260419091836-c5f79b8a11ba/go.mod h1:sCBNcpRmhJCtbFGz49+IM3ETTFf7QdJ30AeYCd43NKk= +github.com/golangci/swaggoswag v0.0.0-20250504205917-77f2aca3143e h1:ai0EfmVYE2bRA5htgAG9r7s3tHsfjIhN98WshBTJ9jM= +github.com/golangci/swaggoswag v0.0.0-20250504205917-77f2aca3143e/go.mod h1:Vrn4B5oR9qRwM+f54koyeH3yzphlecwERs0el27Fr/s= +github.com/golangci/unconvert v0.0.0-20250410112200-a129a6e6413e h1:gD6P7NEo7Eqtt0ssnqSJNNndxe69DOQ24A5h7+i3KpM= +github.com/golangci/unconvert v0.0.0-20250410112200-a129a6e6413e/go.mod h1:h+wZwLjUTJnm/P2rwlbJdRPZXOzaT36/FwnPnY2inzc= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/cel-go v0.28.0 h1:KjSWstCpz/MN5t4a8gnGJNIYUsJRpdi/r97xWDphIQc= +github.com/google/cel-go v0.28.0/go.mod h1:X0bD6iVNR8pkROSOoHVdgTkzmRcosof7WQqCD6wcMc8= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gordonklaus/ineffassign v0.2.0 h1:Uths4KnmwxNJNzq87fwQQDDnbNb7De00VOk9Nu0TySs= +github.com/gordonklaus/ineffassign v0.2.0/go.mod h1:TIpymnagPSexySzs7F9FnO1XFTy8IT3a59vmZp5Y9Lw= +github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= +github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/ojApNWb6C1//mXO48CXbVc= +github.com/gostaticanalysis/comment v1.4.2/go.mod h1:KLUTGDv6HOCotCH8h2erHKmpci2ZoR8VPu34YA2uzdM= +github.com/gostaticanalysis/comment v1.5.0 h1:X82FLl+TswsUMpMh17srGRuKaaXprTaytmEpgnKIDu8= +github.com/gostaticanalysis/comment v1.5.0/go.mod h1:V6eb3gpCv9GNVqb6amXzEUX3jXLVK/AdA+IrAMSqvEc= +github.com/gostaticanalysis/forcetypeassert v0.2.0 h1:uSnWrrUEYDr86OCxWa4/Tp2jeYDlogZiZHzGkWFefTk= +github.com/gostaticanalysis/forcetypeassert v0.2.0/go.mod h1:M5iPavzE9pPqWyeiVXSFghQjljW1+l/Uke3PXHS6ILY= +github.com/gostaticanalysis/nilerr v0.1.2 h1:S6nk8a9N8g062nsx63kUkF6AzbHGw7zzyHMcpu52xQU= +github.com/gostaticanalysis/nilerr v0.1.2/go.mod h1:A19UHhoY3y8ahoL7YKz6sdjDtduwTSI4CsymaC2htPA= +github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/hashicorp/go-immutable-radix/v2 v2.1.0 h1:CUW5RYIcysz+D3B+l1mDeXrQ7fUvGGCwJfdASSzbrfo= +github.com/hashicorp/go-immutable-radix/v2 v2.1.0/go.mod h1:hgdqLXA4f6NIjRVisM1TJ9aOJVNRqKZj+xDGF6m7PBw= +github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaXPSCnA= +github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= +github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.13.0 h1:Hl08k64maU0nrRyVUEbwCnK6/gT0EhMrtAqBHz9/gA4= +github.com/jackc/pgx/v5 v5.13.0/go.mod h1:u2Fi6no03HCSBYE+ZVdLxbwdu3xyi2vU+K/YNJioSds= +github.com/jackc/puddle/v2 v2.2.3 h1:f8HoREISb3l5eO9coPgK7U3hKLhWGokOFVcThl5jrao= +github.com/jackc/puddle/v2 v2.2.3/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jgautheron/goconst v1.11.0 h1:KgN90z5qXt5f0Uzf3cWXev3hfMMFUyNeKdpkSBRvLDk= +github.com/jgautheron/goconst v1.11.0/go.mod h1:0p+wv1lFOiUr0IlNNT1nrm6+8DB8u2sU6KHGzFRXHDc= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jjti/go-spancheck v0.6.5 h1:lmi7pKxa37oKYIMScialXUK6hP3iY5F1gu+mLBPgYB8= +github.com/jjti/go-spancheck v0.6.5/go.mod h1:aEogkeatBrbYsyW6y5TgDfihCulDYciL1B7rG2vSsrU= +github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= +github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/jonboulle/clockwork v0.5.0 h1:Hyh9A8u51kptdkR+cqRpT1EebBwTn1oK9YfGYbdFz6I= +github.com/jonboulle/clockwork v0.5.0/go.mod h1:3mZlmanh0g2NDKO5TWZVJAfofYk64M7XN3SzBPjZF60= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/julz/importas v0.2.0 h1:y+MJN/UdL63QbFJHws9BVC5RpA2iq0kpjrFajTGivjQ= +github.com/julz/importas v0.2.0/go.mod h1:pThlt589EnCYtMnmhmRYY/qn9lCf/frPOK+WMx3xiJY= +github.com/karamaru-alpha/copyloopvar v1.2.2 h1:yfNQvP9YaGQR7VaWLYcfZUlRP2eo2vhExWKxD/fP6q0= +github.com/karamaru-alpha/copyloopvar v1.2.2/go.mod h1:oY4rGZqZ879JkJMtX3RRkcXRkmUvH0x35ykgaKgsgJY= +github.com/kisielk/errcheck v1.20.0 h1:9rwHBNKzd4wkDWcROy3DvFGNqEPlkxBg305rvk7HabI= +github.com/kisielk/errcheck v1.20.0/go.mod h1:O+f80MKNwX8Oor2jwgpeQ9An7uJm+hRSgT+h22knRJU= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkHAIKE/contextcheck v1.1.6 h1:7HIyRcnyzxL9Lz06NGhiKvenXq7Zw6Q0UQu/ttjfJCE= +github.com/kkHAIKE/contextcheck v1.1.6/go.mod h1:3dDbMRNBFaq8HFXWC1JyvDSPm43CmE6IuHam8Wr0rkg= +github.com/klauspost/compress v1.20.4 h1:dD0v/bvxtjCBqQu6sx1TNWkalEY5lNTIe+HY9w8TeNI= +github.com/klauspost/compress v1.20.4/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kulti/thelper v0.7.1 h1:fI8QITAoFVLx+y+vSyuLBP+rcVIB8jKooNSCT2EiI98= +github.com/kulti/thelper v0.7.1/go.mod h1:NsMjfQEy6sd+9Kfw8kCP61W1I0nerGSYSFnGaxQkcbs= +github.com/kunwardeep/paralleltest v1.0.15 h1:ZMk4Qt306tHIgKISHWFJAO1IDQJLc6uDyJMLyncOb6w= +github.com/kunwardeep/paralleltest v1.0.15/go.mod h1:di4moFqtfz3ToSKxhNjhOZL+696QtJGCFe132CbBLGk= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/ldez/exptostd v0.4.5 h1:kv2ZGUVI6VwRfp/+bcQ6Nbx0ghFWcGIKInkG/oFn1aQ= +github.com/ldez/exptostd v0.4.5/go.mod h1:QRjHRMXJrCTIm9WxVNH6VW7oN7KrGSht69bIRwvdFsM= +github.com/ldez/gomoddirectives v0.10.0 h1:Zb23rfMMkG21B6pZ9OfESzemByP5Qr7YvWcXQZE/S3Q= +github.com/ldez/gomoddirectives v0.10.0/go.mod h1:W9uh0721Vc7aaVoiMXTpKIveLmtHC9uaOSiHM4OK5a8= +github.com/ldez/grignotin v0.10.1 h1:keYi9rYsgbvqAZGI1liek5c+jv9UUjbvdj3Tbn5fn4o= +github.com/ldez/grignotin v0.10.1/go.mod h1:UlDbXFCARrXbWGNGP3S5vsysNXAPhnSuBufpTEbwOas= +github.com/ldez/structtags v0.6.1 h1:bUooFLbXx41tW8SvkfwfFkkjPYvFFs59AAMgVg6DUBk= +github.com/ldez/structtags v0.6.1/go.mod h1:YDxVSgDy/MON6ariaxLF2X09bh19qL7MtGBN5MrvbdY= +github.com/ldez/tagliatelle v0.8.0 h1:QczqVPa22JdT40p3m5JTTVmPMv5wDORqdomJn6/Pnn0= +github.com/ldez/tagliatelle v0.8.0/go.mod h1:K9n83Wv0wyVq3JYF9WI28BX8xXhDBVP3thHJ0ENuiEs= +github.com/ldez/usetesting v0.5.0 h1:3/QtzZObBKLy1F4F8jLuKJiKBjjVFi1IavpoWbmqLwc= +github.com/ldez/usetesting v0.5.0/go.mod h1:Spnb4Qppf8JTuRgblLrEWb7IE6rDmUpGvxY3iRrzvDQ= +github.com/leonklingele/grouper v1.1.2 h1:o1ARBDLOmmasUaNDesWqWCIFH3u7hoFlM84YrjT3mIY= +github.com/leonklingele/grouper v1.1.2/go.mod h1:6D0M/HVkhs2yRKRFZUoGjeDy7EZTfFBE9gl4kjmIGkA= +github.com/lucasb-eyer/go-colorful v1.4.1 h1:1EO+WB73+EH8EVbzlrG3KLAfEypQWVHIBqlTf+2hNss= +github.com/lucasb-eyer/go-colorful v1.4.1/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= +github.com/macabu/inamedparam v0.2.0 h1:VyPYpOc10nkhI2qeNUdh3Zket4fcZjEWe35poddBCpE= +github.com/macabu/inamedparam v0.2.0/go.mod h1:+Pee9/YfGe5LJ62pYXqB89lJ+0k5bsR8Wgz/C0Zlq3U= +github.com/manuelarte/embeddedstructfieldcheck v0.4.0 h1:3mAIyaGRtjK6EO9E73JlXLtiy7ha80b2ZVGyacxgfww= +github.com/manuelarte/embeddedstructfieldcheck v0.4.0/go.mod h1:z8dFSyXqp+fC6NLDSljRJeNQJJDWnY7RoWFzV3PC6UM= +github.com/manuelarte/funcorder v0.6.0 h1:0hBngc4fa1IgNiI65A7sFGkMvoMCc878RjqB5V7rWP0= +github.com/manuelarte/funcorder v0.6.0/go.mod h1:id3NDhXdQBmeqXH7eVC6Z89xS6JxvZ8kF9xUxpArU/g= +github.com/maratori/testableexamples v1.0.1 h1:HfOQXs+XgfeRBJ+Wz0XfH+FHnoY9TVqL6Fcevpzy4q8= +github.com/maratori/testableexamples v1.0.1/go.mod h1:XE2F/nQs7B9N08JgyRmdGjYVGqxWwClLPCGSQhXQSrQ= +github.com/maratori/testpackage v1.1.2 h1:ffDSh+AgqluCLMXhM19f/cpvQAKygKAJXFl9aUjmbqs= +github.com/maratori/testpackage v1.1.2/go.mod h1:8F24GdVDFW5Ew43Et02jamrVMNXLUNaOynhDssITGfc= +github.com/matoous/godox v1.1.0 h1:W5mqwbyWrwZv6OQ5Z1a/DHGMOvXYCBP3+Ht7KMoJhq4= +github.com/matoous/godox v1.1.0/go.mod h1:jgE/3fUXiTurkdHOLT5WEkThTSuE7yxHv5iWPa80afs= +github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY= +github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4= +github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4= +github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI= +github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A= +github.com/mattn/go-runewidth v0.0.24 h1:cpokDiIn0MGnhdHwuWnJBITySJ20QyNGnY2kR/ay2DU= +github.com/mattn/go-runewidth v0.0.24/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY= +github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg= +github.com/mfridman/xflag v0.1.0 h1:TWZrZwG1QklFX5S4j1vxfF1sZbZeZSGofMwPMLAF29M= +github.com/mfridman/xflag v0.1.0/go.mod h1:/483ywM5ZO5SuMVjrIGquYNE5CzLrj5Ux/LxWWnjRaE= +github.com/mgechev/revive v1.17.0 h1:hwTTVC3svSv9X2FA2hiYT17Uws+lfxDWhPxzBZZCREg= +github.com/mgechev/revive v1.17.0/go.mod h1:uiVNUF8ruVh4WHm/aPs7kKEeuo+m6oO3tuOfniyzP/g= +github.com/microsoft/go-mssqldb v1.11.2 h1:FCgeBIK8um2+X4tbun6Q71N1KsfyCDPKY41e1yGVjSE= +github.com/microsoft/go-mssqldb v1.11.2/go.mod h1:CYgwG5AMXFojbjTg+GNP5G/y6uz1BhTyZaPqQWzkGnQ= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/moricho/tparallel v0.3.2 h1:odr8aZVFA3NZrNybggMkYO3rgPRcqjeQUlBBFVxKHTI= +github.com/moricho/tparallel v0.3.2/go.mod h1:OQ+K3b4Ln3l2TZveGCywybl68glfLEwFGqvnjok8b+U= +github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= +github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= +github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4Ngq6aY7OE= +github.com/ncruces/go-sqlite3 v0.32.0 h1:hNBUXp88LrfQCsuyXLqWTbTUG35sUuktDsqhhgHvU20= +github.com/ncruces/go-sqlite3 v0.32.0/go.mod h1:MIWTK60ONDl0oVY073zYvJP21C3Dly6P9bxVpgkLwdQ= +github.com/ncruces/go-strftime v1.1.0 h1:vtPmPWMkb539RGV9WpWT9EwJGvrOCKvMNI4obWL47Hk= +github.com/ncruces/go-strftime v1.1.0/go.mod h1:yVaq7iwCN09vHRrKBrrflXT0M9tTMG2KmZ9Fj7xeG/g= +github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M= +github.com/ncruces/julianday v1.0.0/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g= +github.com/nishanths/exhaustive v0.13.0 h1:Rof0axOSNQaaPaPmLK5RxcRrJV2Vcv+vfUmuRy+2EAM= +github.com/nishanths/exhaustive v0.13.0/go.mod h1:3/adQjJgvD/UFHHSYBjpK9Wbz8DOvf0FBtzx+zI0Rlo= +github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= +github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= +github.com/nunnatsa/ginkgolinter v0.24.0 h1:Mp0EagluLFP98JatP6nqp/gGEoljNG97uf9AcxcBVy8= +github.com/nunnatsa/ginkgolinter v0.24.0/go.mod h1:2ZMRuzX6+3XXyY6UZOwb6n+MCocVGbkIsDBC4vuWz5c= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oapi-codegen/nullable v1.1.0 h1:eAh8JVc5430VtYVnq00Hrbpag9PFRGWLjxR1/3KntMs= +github.com/oapi-codegen/nullable v1.1.0/go.mod h1:KUZ3vUzkmEKY90ksAmit2+5juDIhIZhfDl+0PwOQlFY= +github.com/oapi-codegen/oapi-codegen/v2 v2.8.0 h1:s4hxMxuqtR8jPzXkBTtFwY/SBuj3gEAYikmbBSdtLMM= +github.com/oapi-codegen/oapi-codegen/v2 v2.8.0/go.mod h1:yae2TI9IYB5vxQ35gFrpXh9L5H1eJv4MAUK1jumGMTo= +github.com/oapi-codegen/runtime v1.7.0 h1:t7358VYPvNbWJ9gdAkIK/smVeHpBf6yp8VTsaZsb/7k= +github.com/oapi-codegen/runtime v1.7.0/go.mod h1:GwV7hC2hviaMzj+ITfHVRESK5J2W/GefVwIND/bMGvU= +github.com/oasdiff/yaml v0.1.1 h1:6nHx+pn9gBRM6YpBlFZFQGCCd1nuvqOBtTD3KKTgGxY= +github.com/oasdiff/yaml v0.1.1/go.mod h1:EYJNoyktvWMJ0Hmhx+6qTaqMOsalUaRGT8Sj1hNcegU= +github.com/oasdiff/yaml3 v0.0.14 h1:aLJee3hxBK2H5wdXd9iPcIXb93Nty1Ge0pT171eHtkw= +github.com/oasdiff/yaml3 v0.0.14/go.mod h1:csto2xfDjYccdUn/yw/bPjj/cYTdp6HtFA0J4TWG+gg= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.2/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.42.1 h1:iN1rCUX+44NZ1Dc97MPoeFYbFR0vh8zxoxMFwKdyZ6I= +github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= +github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= +github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= +github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= +github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= +github.com/paulmach/orb v0.14.0 h1:GE96348pAD+JkRTp8z5YMiPd1lqUEcFIFGi20C2n5uM= +github.com/paulmach/orb v0.14.0/go.mod h1:6scRWINywA2Jf05dcjOfLfxrUIMECvTSG2MVbRLxu/k= +github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= +github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= +github.com/pelletier/go-toml/v2 v2.4.3 h1:GTRvJQutkOSftxIFD5xw9aepkYNuPWmVJpffdDPYVpY= +github.com/pelletier/go-toml/v2 v2.4.3/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= +github.com/pganalyze/pg_query_go/v6 v6.2.2 h1:O0L6zMC226R82RF3X5n0Ki6HjytDsoAzuzp4ATVAHNo= +github.com/pganalyze/pg_query_go/v6 v6.2.2/go.mod h1:Cn6+j4870kJz3iYNsb0VsNG04vpSWgEvBwc590J4qD0= +github.com/pierrec/lz4/v4 v4.1.33 h1:GjG1TJ1V4IzKP8L96muuuDNpTwd7D+l2ccXrjAbe014= +github.com/pierrec/lz4/v4 v4.1.33/go.mod h1:7SE9MC2STkNtL4PIwGhjmyVwvILaGI9/COYQNBhKM/c= +github.com/pingcap/errors v0.11.0/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pingcap/errors v0.11.5-0.20250523034308-74f78ae071ee h1:/IDPbpzkzA97t1/Z1+C3KlxbevjMeaI6BQYxvivu4u8= +github.com/pingcap/errors v0.11.5-0.20250523034308-74f78ae071ee/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= +github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 h1:tdMsjOqUR7YXHoBitzdebTvOjs/swniBTOLy5XiMtuE= +github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86/go.mod h1:exzhVYca3WRtd6gclGNErRWb1qEgff3LYta0LvRmON4= +github.com/pingcap/log v1.1.0 h1:ELiPxACz7vdo1qAvvaWJg1NrYFoY6gqAh/+Uo6aXdD8= +github.com/pingcap/log v1.1.0/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= +github.com/pingcap/tidb/pkg/parser v0.0.0-20260418072757-ce92298d1124 h1:zYmP5fBH+i2yhhU6f5uOol6zxHtR2/sD47BsJLfy0oU= +github.com/pingcap/tidb/pkg/parser v0.0.0-20260418072757-ce92298d1124/go.mod h1:zDLDsfNBU5+L6T4J9/OgWAHc/WZvMUjbpgHqQ/t3yKo= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pressly/goose/v3 v3.30.0 h1:hmsrzlpLLKiIxukTV1YKCfSoM/F0QZGGmJLsbXcYD/I= +github.com/pressly/goose/v3 v3.30.0/go.mod h1:aw7C4/P6xjcOoa3Nsj9H2xGmLyIs+JgSLTUImg2KaWE= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1 h1:ZiaPsmm9uiBeaSMRznKsCDNtPCS0T3JVDGF+06gjBzk= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.23.0 h1:ad+S6FTkzwaMgacKLM5h6bNKExS+DMH0YiUwXItH/o4= +github.com/prometheus/procfs v0.23.0/go.mod h1:3AVXO0FqLafyYFU/V/IQRZlC8Rgqz8Dm/x6pKLK+RIk= +github.com/quasilyte/go-ruleguard v0.4.5 h1:AGY0tiOT5hJX9BTdx/xBdoCubQUAE2grkqY2lSwvZcA= +github.com/quasilyte/go-ruleguard v0.4.5/go.mod h1:Vl05zJ538vcEEwu16V/Hdu7IYZWyKSwIy4c88Ro1kRE= +github.com/quasilyte/go-ruleguard/dsl v0.3.23 h1:lxjt5B6ZCiBeeNO8/oQsegE6fLeCzuMRoVWSkXC4uvY= +github.com/quasilyte/go-ruleguard/dsl v0.3.23/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= +github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo= +github.com/quasilyte/gogrep v0.5.0/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng= +github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 h1:TCg2WBOl980XxGFEZSS6KlBGIV0diGdySzxATTWoqaU= +github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= +github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= +github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= +github.com/raeperd/recvcheck v0.3.1 h1:p7nZMxiCWkdUtY2i3o+pv1h4fJCR5gpvqAXr9326hEY= +github.com/raeperd/recvcheck v0.3.1/go.mod h1:CbE7iRocQ4uc71JwpW/CPSh4BShnkre4A9Gb508RypU= +github.com/redis/go-redis/v9 v9.23.0 h1:/TTVdJa8BRNsybwwGGnmiYktHNlUXtbOQxlWpHBPL3s= +github.com/redis/go-redis/v9 v9.23.0/go.mod h1:EWP2UUk+XDaI1s5nQB5mablZN6vccXlmBQTyfnF87D0= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/riza-io/grpc-go v0.2.0 h1:2HxQKFVE7VuYstcJ8zqpN84VnAoJ4dCL6YFhJewNcHQ= +github.com/riza-io/grpc-go v0.2.0/go.mod h1:2bDvR9KkKC3KhtlSHfR3dAXjUMT86kg4UfWFyVGWqi8= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/rogpeppe/go-internal v1.16.0 h1:O9DK+vNMDVGLr2BeZqmpLeMjiMNkuXfcqntWbZV6S5g= +github.com/rogpeppe/go-internal v1.16.0/go.mod h1:DrUVZyrJU+txYW5/1kwtXQSMFio52ZOxX7yM1VHvnxs= +github.com/rs/zerolog v1.35.1 h1:m7xQeoiLIiV0BCEY4Hs+j2NG4Gp2o2KPKmhnnLiazKI= +github.com/rs/zerolog v1.35.1/go.mod h1:EjML9kdfa/RMA7h/6z6pYmq1ykOuA8/mjWaEvGI+jcw= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryancurrah/gomodguard v1.4.1 h1:eWC8eUMNZ/wM/PWuZBv7JxxqT5fiIKSIyTvjb7Elr+g= +github.com/ryancurrah/gomodguard v1.4.1/go.mod h1:qnMJwV1hX9m+YJseXEBhd2s90+1Xn6x9dLz11ualI1I= +github.com/ryancurrah/gomodguard/v2 v2.1.3 h1:E7sz3PJwE9Ba1reVxSpF6XLCPJZ74Kfw/LabTNM4GIA= +github.com/ryancurrah/gomodguard/v2 v2.1.3/go.mod h1:CQicdLGatWMxLX53JzoBjYlsNZhHbmLv2AVa0s2aivU= +github.com/ryanrolds/sqlclosecheck v0.6.0 h1:pEyL9okISdg1F1SEpJNlrEotkTGerv5BMk7U4AG0eVg= +github.com/ryanrolds/sqlclosecheck v0.6.0/go.mod h1:xyX16hsDaCMXHrMJ3JMzGf5OpDfHTOTTQrT7HOFUmeU= +github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc= +github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik= +github.com/sanposhiho/wastedassign/v2 v2.1.0 h1:crurBF7fJKIORrV85u9UUpePDYGWnwvv3+A96WvwXT0= +github.com/sanposhiho/wastedassign/v2 v2.1.0/go.mod h1:+oSmSC+9bQ+VUAxA66nBb0Z7N8CK7mscKTDYC6aIek4= +github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 h1:KRzFb2m7YtdldCEkzs6KqmJw4nqEVZGK7IN2kJkjTuQ= +github.com/santhosh-tekuri/jsonschema/v6 v6.0.2/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU= +github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 h1:1EYB5IzjZawrrnELUi78f9fPu57HuXjmddZPjrls/28= +github.com/santhosh-tekuri/jsonschema/v6 v6.0.3/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU= +github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= +github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= +github.com/sashamelentyev/usestdlibvars v1.29.0 h1:8J0MoRrw4/NAXtjQqTHrbW9NN+3iMf7Knkq057v4XOQ= +github.com/sashamelentyev/usestdlibvars v1.29.0/go.mod h1:8PpnjHMk5VdeWlVb4wCdrB8PNbLqZ3wBZTZWkrpZZL8= +github.com/securego/gosec/v2 v2.29.0 h1:pF2HSLcnY5voqpxQumEe0O5YAAbvF4Syu4qeIewpLyc= +github.com/securego/gosec/v2 v2.29.0/go.mod h1:47C7ej+L2bC1NOxteU2aCGnCi4cZaoKzRt5y9plIvuY= +github.com/segmentio/asm v1.2.1 h1:DTNbBqs57ioxAD4PrArqftgypG4/qNpXoJx8TVXxPR0= +github.com/segmentio/asm v1.2.1/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= +github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= +github.com/sethvargo/go-retry v0.5.0 h1:JYfFKmVJ8ER06GReN1efzc5cm52BrVsFVzmcHiKJwfY= +github.com/sethvargo/go-retry v0.5.0/go.mod h1:tvsjdKG6xfiCx4LSiUZ06kcv38xvdVQwv8R6/VnnVWg= +github.com/shopspring/decimal v1.6.0 h1:DcTwjCj4tJPLuGZYsR9W0hyX9pQwMIkdo26Ig1T9xX4= +github.com/shopspring/decimal v1.6.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.10.2 h1:G2SED73/qrAu6YwbdxOD6peLkCBI3z7L+ykJFTXJBBo= +github.com/sirupsen/logrus v1.10.2/go.mod h1:SLEg8TqYulVKKfIGHldVp2K2aYz2DKSVBq4g/H5bR7Q= +github.com/sivchari/containedctx v1.0.3 h1:x+etemjbsh2fB5ewm5FeLNi5bUjK0V8n0RB+Wwfd0XE= +github.com/sivchari/containedctx v1.0.3/go.mod h1:c1RDvCbnJLtH4lLcYD/GqwiBSSf4F5Qk0xld2rBqzJ4= +github.com/sonatard/noctx v0.5.1 h1:wklWg9c9ZYugOAk7qG4yP4PBrlQsmSLPTvW1K4PRQMs= +github.com/sonatard/noctx v0.5.1/go.mod h1:64XdbzFb18XL4LporKXp8poqZtPKbCrqQ402CV+kJas= +github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw= +github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U= +github.com/sourcegraph/go-diff v0.9.0 h1:7xcVsayWHhvxZGrqt1o89vvBApCa4nyCgO7tNxDHJ+Q= +github.com/sourcegraph/go-diff v0.9.0/go.mod h1:hWlcO7Al+UZStZAP8rBumHpCK5ZHQ5BXsMls8p4+F5E= +github.com/speakeasy-api/jsonpath v0.6.3 h1:c+QPwzAOdrWvzycuc9HFsIZcxKIaWcNpC+xhOW9rJxU= +github.com/speakeasy-api/jsonpath v0.6.3/go.mod h1:2cXloNuQ+RSXi5HTRaeBh7JEmjRXTiaKpFTdZiL7URI= +github.com/speakeasy-api/openapi v1.24.0 h1:opoD27rupX7zBVPq1HkIGLeMOzNNA7JalhYP8q34i04= +github.com/speakeasy-api/openapi v1.24.0/go.mod h1:g3+dIMe0AYgbbGvnlQZqesmjAVWSm9BmsjLevnefQrg= +github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= +github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg= +github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= +github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU= +github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY= +github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= +github.com/sqlc-dev/doubleclick v1.0.0 h1:2/OApfQ2eLgcfa/Fqs8WSMA6atH0G8j9hHbQIgMfAXI= +github.com/sqlc-dev/doubleclick v1.0.0/go.mod h1:ODHRroSrk/rr5neRHlWMSRijqOak8YmNaO3VAZCNl5Y= +github.com/sqlc-dev/sqlc v1.31.1 h1:+V+BjBJfFNPX/RFfL8eiZD9jk9lVJUEGGllWvnYNqbc= +github.com/sqlc-dev/sqlc v1.31.1/go.mod h1:6ZPww/Jd3G6MzJeW6NrqizjL+52vYNaaXP9yMeJ/Nao= +github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= +github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= +github.com/stbenjam/no-sprintf-host-port v0.3.1 h1:AyX7+dxI4IdLBPtDbsGAyqiTSLpCP9hWRrXQDU4Cm/g= +github.com/stbenjam/no-sprintf-host-port v0.3.1/go.mod h1:ODbZesTCHMVKthBHskvUUexdcNHAQRXk9NpSsL8p/HQ= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= +github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= +github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= +github.com/tetafro/godot v1.5.6 h1:IEkrFCwXaYHlOn4mGzGS3F3dkP6m9t0jpwqBFPIkKiA= +github.com/tetafro/godot v1.5.6/go.mod h1:eOkMrVQurDui411nBY2FA05EYH01r14LuWY/NrVDVcU= +github.com/tetratelabs/wazero v1.11.0 h1:+gKemEuKCTevU4d7ZTzlsvgd1uaToIDtlQlmNbwqYhA= +github.com/tetratelabs/wazero v1.11.0/go.mod h1:eV28rsN8Q+xwjogd7f4/Pp4xFxO7uOGbLcD/LzB1wiU= +github.com/timakin/bodyclose v0.0.0-20260723120731-857993a2939c h1:d/FUP8GD4QiY/rdFzZmBu3KqL9eBNVzMu7W/5pGkaMM= +github.com/timakin/bodyclose v0.0.0-20260723120731-857993a2939c/go.mod h1:sDHLK7rb/59v/ZxZ7KtymgcoxuUMxjXq8gtu9VMOK8M= +github.com/timonwong/loggercheck v0.12.0 h1:7Cb9XGLJZSWYNjgL459DIhpSiEHupD+MLQ6vaN2Pl3g= +github.com/timonwong/loggercheck v0.12.0/go.mod h1:Wa6Y+SJHQR01mViZlLLY5GAZVOWOLNMbkXddMjFWQCs= +github.com/tomarrell/wrapcheck/v2 v2.12.0 h1:H/qQ1aNWz/eeIhxKAFvkfIA+N7YDvq6TWVFL27Of9is= +github.com/tomarrell/wrapcheck/v2 v2.12.0/go.mod h1:AQhQuZd0p7b6rfW+vUwHm5OMCGgp63moQ9Qr/0BpIWo= +github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= +github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= +github.com/tursodatabase/libsql-client-go v0.0.0-20260528064733-9d5d30a29a60 h1:TfQEwhr0Q9t+Bgs0TNk2eHZ9EGD107Mimic0kcoGS1M= +github.com/tursodatabase/libsql-client-go v0.0.0-20260528064733-9d5d30a29a60/go.mod h1:08inkKyguB6CGGssc/JzhmQWwBgFQBgjlYFjxjRh7nU= +github.com/ultraware/funlen v0.2.0 h1:gCHmCn+d2/1SemTdYMiKLAHFYxTYz7z9VIDRaTGyLkI= +github.com/ultraware/funlen v0.2.0/go.mod h1:ZE0q4TsJ8T1SQcjmkhN/w+MceuatI6pBFSxxyteHIJA= +github.com/ultraware/whitespace v0.2.0 h1:TYowo2m9Nfj1baEQBjuHzvMRbp19i+RCcRYrSWoFa+g= +github.com/ultraware/whitespace v0.2.0/go.mod h1:XcP1RLD81eV4BW8UhQlpaR+SDc2givTvyI8a586WjW8= +github.com/uudashr/gocognit v1.2.1 h1:CSJynt5txTnORn/DkhiB4mZjwPuifyASC8/6Q0I/QS4= +github.com/uudashr/gocognit v1.2.1/go.mod h1:acaubQc6xYlXFEMb9nWX2dYBzJ/bIjEkc1zzvyIZg5Q= +github.com/uudashr/iface v1.5.1 h1:BS3yrgaT55s3dAtJoxuTnsZNbsejq/mVuzp49YDyfBA= +github.com/uudashr/iface v1.5.1/go.mod h1:5UWoT6SvTdTww/KToRj6clO+n4Kg3/NrAQvgOB+5Ggw= +github.com/vertica/vertica-sql-go v1.3.9 h1:QL2ccdxFHQ0A3ViXnjCevuIFvA0LeYO7DZVT/Ok7Mz4= +github.com/vertica/vertica-sql-go v1.3.9/go.mod h1:c4OZ8lq1Ztc18w8a0nG+dzQh69BzJRcKN2LZOnYbERI= +github.com/vmware-labs/yaml-jsonpath v0.3.2 h1:/5QKeCBGdsInyDCyVNLbXyilb61MXGi9NP674f9Hobk= +github.com/vmware-labs/yaml-jsonpath v0.3.2/go.mod h1:U6whw1z03QyqgWdgXxvVnQ90zN1BWz5V+51Ewf8k+rQ= +github.com/wasilibs/go-pgquery v0.0.0-20250409022910-10ac41983c07 h1:mJdDDPblDfPe7z7go8Dvv1AJQDI3eQ/5xith3q2mFlo= +github.com/wasilibs/go-pgquery v0.0.0-20250409022910-10ac41983c07/go.mod h1:Ak17IJ037caFp4jpCw/iQQ7/W74Sqpb1YuKJU6HTKfM= +github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 h1:OvLBa8SqJnZ6P+mjlzc2K7PM22rRUPE1x32G9DTPrC4= +github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52/go.mod h1:jMeV4Vpbi8osrE/pKUxRZkVaA0EX7NZN0A9/oRzgpgY= +github.com/xen0n/gosmopolitan v1.3.0 h1:zAZI1zefvo7gcpbCOrPSHJZJYA9ZgLfJqtKzZ5pHqQM= +github.com/xen0n/gosmopolitan v1.3.0/go.mod h1:rckfr5T6o4lBtM1ga7mLGKZmLxswUoH1zxHgNXOsEt4= +github.com/xo/terminfo v1.0.0 h1:2ZpYzqWzyyytjk3TP6aJVDhkMAkc99/1xKQdA3TDTBY= +github.com/xo/terminfo v1.0.0/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= +github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= +github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= +github.com/yandex-cloud/go-genproto v0.137.0 h1:H4d1qxiB4uxH/KMzvzkM1CyJaqUZDzOxu3K81et/moE= +github.com/yandex-cloud/go-genproto v0.137.0/go.mod h1:0LDD/IZLIUIV4iPH+YcF+jysO3jkSvADFGm4dCAuwQo= +github.com/ydb-platform/ydb-go-genproto v0.0.0-20260810123728-f0c151ab31b9 h1:WcjfLaNwBZzyl0a/2Ms+tucKRZvulR1HMXM9V7evjLc= +github.com/ydb-platform/ydb-go-genproto v0.0.0-20260810123728-f0c151ab31b9/go.mod h1:Er+FePu1dNUieD+XTMDduGpQuCPssK5Q4BjF+IIXJ3I= +github.com/ydb-platform/ydb-go-sdk-auth-environ v0.5.3 h1:A48PcmIETWwbEMIGwndv52uME6J1eJ28MBgF7HVR74o= +github.com/ydb-platform/ydb-go-sdk-auth-environ v0.5.3/go.mod h1:oRGF+67GWLbtNzqGygsPIUsjXmsRXD1KS5m3o5ppm2k= +github.com/ydb-platform/ydb-go-sdk/v3 v3.156.1 h1:K0dvmAt4yy0tznpiPCBk3H4KCgB1TxEeEfb8zeXA5Kc= +github.com/ydb-platform/ydb-go-sdk/v3 v3.156.1/go.mod h1:dJXJ1u00IqO8Vsph8fWmYj8b1E7jyphnvJPqA69emBY= +github.com/ydb-platform/ydb-go-yc v0.12.5 h1:qYIeU1N6a92FaDA0+/vR55l5IzRF50MeLZwUWwvy2xQ= +github.com/ydb-platform/ydb-go-yc v0.12.5/go.mod h1:DlSltVQKEdXJotaAYwoHzMGDF9EJw5S3hg3LXe/5yYw= +github.com/ydb-platform/ydb-go-yc-metadata v0.6.2 h1:CZFawwHjLcjsxcl/g0dGIXbI2r41okPGLCydF4qTHcc= +github.com/ydb-platform/ydb-go-yc-metadata v0.6.2/go.mod h1:mU1NRwVEHF+WyO1q6etWycy17N/S5288uUbsMvvk9ps= +github.com/yeya24/promlinter v0.3.0 h1:JVDbMp08lVCP7Y6NP3qHroGAO6z2yGKQtS5JsjqtoFs= +github.com/yeya24/promlinter v0.3.0/go.mod h1:cDfJQQYv9uYciW60QT0eeHlFodotkYZlL+YcPQN+mW4= +github.com/ykadowak/zerologlint v0.1.5 h1:Gy/fMz1dFQN9JZTPjv1hxEk+sRWm05row04Yoolgdiw= +github.com/ykadowak/zerologlint v0.1.5/go.mod h1:KaUskqF3e/v59oPmdq1U1DnKcuHokl2/K1U4pmIELKg= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs= +github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= +gitlab.com/bosi/decorder v0.4.2 h1:qbQaV3zgwnBZ4zPMhGLW4KZe7A7NwxEhJx39R3shffo= +gitlab.com/bosi/decorder v0.4.2/go.mod h1:muuhHoaJkA9QLcYHq4Mj8FJUwDZ+EirSHRiaTcTf6T8= +go-simpler.org/musttag v0.14.0 h1:XGySZATqQYSEV3/YTy+iX+aofbZZllJaqwFWs+RTtSo= +go-simpler.org/musttag v0.14.0/go.mod h1:uP8EymctQjJ4Z1kUnjX0u2l60WfUdQxCwSNKzE1JEOE= +go-simpler.org/sloglint v0.12.0 h1:UzWDlLWNE5FLqsvyq3tWYHuQMbqrervOhT8qPl4Mmw4= +go-simpler.org/sloglint v0.12.0/go.mod h1:jBjjC2bm8rYrs88oTRlFX497kWjJsyZWYoNaXkGRI6I= +go.augendre.info/arangolint v0.4.0 h1:xSCZjRoS93nXazBSg5d0OGCi9APPLNMmmLrC995tR50= +go.augendre.info/arangolint v0.4.0/go.mod h1:l+f/b4plABuFISuKnTGD4RioXiCCgghv2xqst/xOvAA= +go.augendre.info/fatcontext v0.10.1 h1:HCS/+eob32cM0mEtmZM6NiXdqvS5KiZmsR+fCubTpbc= +go.augendre.info/fatcontext v0.10.1/go.mod h1:pqpGvA9GlrXy+aXkp8L2dKz12Zp4g2FhzcAtwToU+2w= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opentelemetry.io/otel v1.47.0 h1:j7ALJ/zgkS7Z6aeJW09p8VC9804bC+PpeTfCD4XPnOM= +go.opentelemetry.io/otel v1.47.0/go.mod h1:8wS9O2qfXrYrzp6hIF/HOYJJf/wIhFPhR2xLuP+iXQU= +go.opentelemetry.io/otel/trace v1.47.0 h1:JOjX/Oci8K94QHddo+bbfya/Ai/nf6/dt9ZfrFNWSrM= +go.opentelemetry.io/otel/trace v1.47.0/go.mod h1:jNaSLa2PZEYFG6fRjJABAu+bw4FS08uDmPg28lTghu0= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.12.0 h1:BvcXdFKuviU4fTL/f+SxdQ5qJX/Jix8pAkgdUcb3XOE= +go.uber.org/atomic v1.12.0/go.mod h1:I6c4cg+6HCxRjfjSsYtApoFILnpc0CGUdGkXVqbYVNk= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= +go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= +go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= +go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= +go.yaml.in/yaml/v3 v3.0.6 h1:zcDfvjXEqTQmpjniUBLc91xYJMB2c4QOFxEF/LCEckM= +go.yaml.in/yaml/v3 v3.0.6/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.59.0 h1:xS2jhqYbzNrpvkWP2YTDf4TJwBy3ykR03i8vFDxEc7c= +golang.org/x/crypto v0.59.0/go.mod h1:veDyUwATGs3c+vN3VfTbzViMGXeTBk3WyhBOkn+F/4U= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o= +golang.org/x/exp v0.0.0-20261109185158-a52e3aef5920 h1:qr+tk4P56rtbVVAJDyAr5LAOiaD/XhZCoRTr4SfLxAk= +golang.org/x/exp v0.0.0-20261109185158-a52e3aef5920/go.mod h1:J3U+E8RzytcGvwz+uJuAP4zULJ2TkAQBnmPZMexpdXs= +golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20260811152304-ee035b5b010f h1:+lI8cDJ4uceLipg2f1ODay7fEuLkk0BIHXd6PB8icxo= +golang.org/x/exp/typeparams v0.0.0-20260811152304-ee035b5b010f/go.mod h1:PqrXSW65cXDZH0k4IeUbhmg/bcAZDbzNz3byBpKCsXo= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk= +golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40= +golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c= +golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o= +golang.org/x/mod v0.42.0 h1:ICeL3t2L30ljSPHHxDnR4fqVcBt/zR2zJAb9juavmQg= +golang.org/x/mod v0.42.0/go.mod h1:u5fzIrRInkL8MaO1cbRkUHT64v303YIT5KEqpNr7jRs= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= +golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= +golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues= +golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY= +golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= +golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sync v0.25.0 h1:dJnifr0nMV8/SBnBvdo4eSGGnrc3O4FFx6IqvtLcmRs= +golang.org/x/sync v0.25.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= +golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= +golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/sys v0.50.0 h1:dkKZEFTEKaLr1sjhs0WiKqoi8Jj5nHbS3Njmx1UoMJs= +golang.org/x/sys v0.50.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= +golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= +golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= +golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= +golang.org/x/text v0.44.0 h1:YItdp/mQNGnsmrgpcdA5yQ3bnRxCfo/Tj/iByGW9GGo= +golang.org/x/text v0.44.0/go.mod h1:S4FR1waQ9LbjQTls97SyRjDaUUVkaM+cXwwuG/G+MwY= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.1-0.20210205202024-ef80cdb6ec6d/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= +golang.org/x/tools v0.1.1-0.20210302220138-2ac05c832e1a/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= +golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.48.0 h1:3+hClM1aLL5mjMKm5ovokw9epgRXPuu2tILgismM6RE= +golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk= +golang.org/x/tools v0.50.0 h1:c2ifzfcuY7L90lZ2aKd8S4K2NpASF08SZx9ZuJkHmSU= +golang.org/x/tools v0.50.0/go.mod h1:7ulVMw3831Mwi5EZD6RomGyffr4VFjuNYXf2BbCEAV0= +golang.org/x/tools v0.52.0 h1:ryxg4U63oaUYk7uOLTF37n43f4qgtGvqV4Ioit1BaEs= +golang.org/x/tools v0.52.0/go.mod h1:ItcP5UNaVGG+Yc4eIYmaFLNJ4soEopkx5Y2d4lcEurs= +golang.org/x/tools v0.52.1-0.20261106145633-d407941a339a h1:Yqozs0FNPRoPGS4hNGlrNwRENWr5H5nVG9sN/f+5640= +golang.org/x/tools v0.52.1-0.20261106145633-d407941a339a/go.mod h1:ItcP5UNaVGG+Yc4eIYmaFLNJ4soEopkx5Y2d4lcEurs= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 h1:BulPr26Jqjnd4eYDVe+YvyR7Yc2vJGkO5/0UxD0/jZU= +google.golang.org/genproto/googleapis/api v0.0.0-20261110000943-09e21b237f2c h1:ofk4SEqvpf6M5VWh88xRp42IYgdVOh7gffebnDj3OqU= +google.golang.org/genproto/googleapis/api v0.0.0-20261110000943-09e21b237f2c/go.mod h1:OzYcNQzaMRKcOFRMtyLzG/cfW1SmS2eh+7UmOLLFblk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261110000943-09e21b237f2c h1:XXChExL+Tm7Ubp0x0VXUEncPLHrkXIgoVWqnxmKNbAA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261110000943-09e21b237f2c/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.85.0 h1:BPBCfuVRQ1qvBhKDOq9uvQllMvO59rKsYhXpp7Dd8vw= +google.golang.org/grpc v1.85.0/go.mod h1:0rQrOD58yjal/0EaVbGBANindixsCZNQPDV3VKtaKuQ= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= +google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20191026110619-0b21df46bc1d/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.8.1 h1:+JKf3xJ1ni4CwrhVg4/pqsfPGP6vNAXcKbMXJodYx3w= +honnef.co/go/tools v0.8.1/go.mod h1:XA+OnlRA9EDh/ukGvXMNSZNKGwFQJ+5dER0ioUkOxks= +howett.net/plist v1.0.1 h1:37GdZ8tP09Q35o9ych3ehygcsL+HqKSwzctveSlarvM= +howett.net/plist v1.0.1/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= +modernc.org/libc v1.80.2 h1:3+a4fJZvvzg920ZC0mOepnKPGn7cqCaVeDxm/UnrM1A= +modernc.org/libc v1.80.2/go.mod h1:pvo25Rs3OJEbDqhUV9jdEGevxeLJrJeDmNid/AcQV1g= +modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU= +modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg= +modernc.org/memory v1.12.1 h1:nFMiWrpStgZczNl6XI9GnIk/rWhYIyHGUaR04pGbp9g= +modernc.org/memory v1.12.1/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw= +modernc.org/sqlite v1.62.0 h1:gMaCjSM1qpl+iOjiWhR1LYP3zqrYDI+5GYLGt6veP2g= +modernc.org/sqlite v1.62.0/go.mod h1:Jzjh1mt4s0HuQ0KvtB1LIuHiGRmU2D5pgj8dUhW7/SE= +mvdan.cc/gofumpt v0.12.0 h1:1Lbudkz2kpM9Cjz2pL4M19u7q+GaEhCTNf7N9mfpcho= +mvdan.cc/gofumpt v0.12.0/go.mod h1:SmBHHrljiZu/uoypeKup3rFzP6eoC9UwCp2iH5E3jZA= +mvdan.cc/unparam v0.0.0-20260823230713-2fa3d841b0c8 h1:Re1NRyLpiAt9kB+ImaaoapwWiQXrKwER4tY8fLOkDew= +mvdan.cc/unparam v0.0.0-20260823230713-2fa3d841b0c8/go.mod h1:MrS/+zJ1M2xvGXhKktiHbNQeQPyg3Qel+KkzT+f7/i4= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/backend/internal/adapter/handler/api.gen.go b/backend/internal/adapter/handler/api.gen.go new file mode 100644 index 00000000..3135c541 --- /dev/null +++ b/backend/internal/adapter/handler/api.gen.go @@ -0,0 +1,3223 @@ +// Package handler provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT. +package handler + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "net/http" + + "github.com/go-chi/chi/v5" + "github.com/oapi-codegen/runtime" + openapi_types "github.com/oapi-codegen/runtime/types" +) + +// Defines values for ErrorErrorCode. +const ( + Conflict ErrorErrorCode = "conflict" + InternalError ErrorErrorCode = "internal_error" + InvalidRequest ErrorErrorCode = "invalid_request" + NotFound ErrorErrorCode = "not_found" + PayloadTooLarge ErrorErrorCode = "payload_too_large" + RateLimited ErrorErrorCode = "rate_limited" + Unauthorized ErrorErrorCode = "unauthorized" + Unavailable ErrorErrorCode = "unavailable" + UnsupportedMediaType ErrorErrorCode = "unsupported_media_type" +) + +// Valid indicates whether the value is a known member of the ErrorErrorCode enum. +func (e ErrorErrorCode) Valid() bool { + switch e { + case Conflict: + return true + case InternalError: + return true + case InvalidRequest: + return true + case NotFound: + return true + case PayloadTooLarge: + return true + case RateLimited: + return true + case Unauthorized: + return true + case Unavailable: + return true + case UnsupportedMediaType: + return true + default: + return false + } +} + +// Defines values for HealthStatus. +const ( + Ok HealthStatus = "ok" +) + +// Valid indicates whether the value is a known member of the HealthStatus enum. +func (e HealthStatus) Valid() bool { + switch e { + case Ok: + return true + default: + return false + } +} + +// Defines values for SessionTokenType. +const ( + Bearer SessionTokenType = "Bearer" +) + +// Valid indicates whether the value is a known member of the SessionTokenType enum. +func (e SessionTokenType) Valid() bool { + switch e { + case Bearer: + return true + default: + return false + } +} + +// Chat Examples: {"created_at":"2026-09-01T12:00:00Z","id":"33333333-3333-4333-8333-333333333333","member_ids":["11111111-1111-4111-8111-111111111111","22222222-2222-4222-8222-222222222222"],"title":"Проект по ВНП"} +type Chat struct { + CreatedAt Timestamp `json:"created_at"` + Id openapi_types.UUID `json:"id"` + MemberIds []openapi_types.UUID `json:"member_ids"` + Title string `json:"title"` +} + +// ChatPage defines model for ChatPage. +type ChatPage struct { + Items []Chat `json:"items"` + NextCursor *string `json:"next_cursor"` +} + +// CreateChat Examples: {"member_ids":["11111111-1111-4111-8111-111111111111","22222222-2222-4222-8222-222222222222"],"title":"Проект по ВНП"} +type CreateChat struct { + MemberIds []openapi_types.UUID `json:"member_ids"` + Title string `json:"title"` +} + +// CreateMessage Examples: {"text":"Привет, Боб!"} +type CreateMessage struct { + Text string `json:"text"` +} + +// CreateUser Examples: {"display_name":"Алиса","password":"Example-only-not-a-real-secret-123","username":"alice"} +type CreateUser struct { + DisplayName string `json:"display_name"` + Password *string `json:"password,omitempty"` + Username string `json:"username"` +} + +// Error Examples: {"error":{"code":"not_found","message":"Объект не найден","request_id":"example-request-id"}} +type Error struct { + Error struct { + Code ErrorErrorCode `json:"code"` + Message string `json:"message"` + RequestId string `json:"request_id"` + } `json:"error"` +} + +// ErrorErrorCode defines model for Error.Error.Code. +type ErrorErrorCode string + +// Health defines model for Health. +type Health struct { + Status HealthStatus `json:"status"` +} + +// HealthStatus defines model for Health.Status. +type HealthStatus string + +// Message Examples: {"chat_id":"33333333-3333-4333-8333-333333333333","created_at":"2026-09-01T12:00:00Z","id":"44444444-4444-4444-8444-444444444444","sender_id":"11111111-1111-4111-8111-111111111111","text":"Привет, Боб!"} +type Message struct { + ChatId openapi_types.UUID `json:"chat_id"` + CreatedAt Timestamp `json:"created_at"` + Id openapi_types.UUID `json:"id"` + SenderId openapi_types.UUID `json:"sender_id"` + Text string `json:"text"` +} + +// MessagePage Examples: {"items":[{"chat_id":"33333333-3333-4333-8333-333333333333","created_at":"2026-09-01T12:00:00Z","id":"44444444-4444-4444-8444-444444444444","sender_id":"11111111-1111-4111-8111-111111111111","text":"Привет, Боб!"}],"next_cursor":null} +type MessagePage struct { + Items []Message `json:"items"` + NextCursor *string `json:"next_cursor"` +} + +// Session defines model for Session. +type Session struct { + ExpiresAt Timestamp `json:"expires_at"` + Token string `json:"token"` + TokenType SessionTokenType `json:"token_type"` + + // User Examples: {"created_at":"2026-09-01T12:00:00Z","display_name":"Алиса","id":"11111111-1111-4111-8111-111111111111","username":"alice"} + User User `json:"user"` +} + +// SessionTokenType defines model for Session.TokenType. +type SessionTokenType string + +// User Examples: {"created_at":"2026-09-01T12:00:00Z","display_name":"Алиса","id":"11111111-1111-4111-8111-111111111111","username":"alice"} +type User struct { + CreatedAt Timestamp `json:"created_at"` + DisplayName string `json:"display_name"` + Id openapi_types.UUID `json:"id"` + Username string `json:"username"` +} + +// ListChatsParams defines parameters for ListChats. +type ListChatsParams struct { + Limit *int `form:"limit,omitempty" json:"limit,omitempty"` + Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` +} + +// ListMessagesParams defines parameters for ListMessages. +type ListMessagesParams struct { + Limit *int `form:"limit,omitempty" json:"limit,omitempty"` + Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` +} + +// CreateMessageParams defines parameters for CreateMessage. +type CreateMessageParams struct { + // IdempotencyKey Обязателен с lab3. Область: пользователь + метод + путь + ключ; хранить результат не менее 24 ч. Повтор того же JSON возвращает исходный 201 и то же сообщение, другой JSON — 409. + IdempotencyKey string `json:"Idempotency-Key"` +} + +// CreateChatJSONRequestBody defines body for CreateChat for application/json ContentType. +type CreateChatJSONRequestBody = CreateChat + +// CreateMessageJSONRequestBody defines body for CreateMessage for application/json ContentType. +type CreateMessageJSONRequestBody = CreateMessage + +// RegisterUserJSONRequestBody defines body for RegisterUser for application/json ContentType. +type RegisterUserJSONRequestBody = CreateUser + +// ServerInterface represents all server handlers. +type ServerInterface interface { + // CreateSession Вход: Basic username:password; выдаёт сессию + // (POST /api/v1/auth/sessions) + CreateSession(w http.ResponseWriter, r *http.Request) + // RevokeSession Отозвать текущую сессию + // (DELETE /api/v1/auth/sessions/current) + RevokeSession(w http.ResponseWriter, r *http.Request) + // ListChats Чаты текущего пользователя + // (GET /api/v1/chats) + ListChats(w http.ResponseWriter, r *http.Request, params ListChatsParams) + // CreateChat Создать чат; вызывающий должен входить в member_ids + // (POST /api/v1/chats) + CreateChat(w http.ResponseWriter, r *http.Request) + // GetChat Получить доступный чат + // (GET /api/v1/chats/{chat_id}) + GetChat(w http.ResponseWriter, r *http.Request, chatId openapi_types.UUID) + // ListMessages Сообщения по (created_at, id) по возрастанию + // (GET /api/v1/chats/{chat_id}/messages) + ListMessages(w http.ResponseWriter, r *http.Request, chatId openapi_types.UUID, params ListMessagesParams) + // CreateMessage Отправить сообщение + // (POST /api/v1/chats/{chat_id}/messages) + CreateMessage(w http.ResponseWriter, r *http.Request, chatId openapi_types.UUID, params CreateMessageParams) + // RegisterUser Создать пользователя + // (POST /api/v1/users) + RegisterUser(w http.ResponseWriter, r *http.Request) + // CurrentUser Текущий пользователь + // (GET /api/v1/users/me) + CurrentUser(w http.ResponseWriter, r *http.Request) + // Liveness Процесс жив + // (GET /health/live) + Liveness(w http.ResponseWriter, r *http.Request) + // Readiness Готов принимать трафик + // (GET /health/ready) + Readiness(w http.ResponseWriter, r *http.Request) +} + +// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint. + +type Unimplemented struct{} + +// CreateSession Вход: Basic username:password; выдаёт сессию +// (POST /api/v1/auth/sessions) +func (_ Unimplemented) CreateSession(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// RevokeSession Отозвать текущую сессию +// (DELETE /api/v1/auth/sessions/current) +func (_ Unimplemented) RevokeSession(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ListChats Чаты текущего пользователя +// (GET /api/v1/chats) +func (_ Unimplemented) ListChats(w http.ResponseWriter, r *http.Request, params ListChatsParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// CreateChat Создать чат; вызывающий должен входить в member_ids +// (POST /api/v1/chats) +func (_ Unimplemented) CreateChat(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// GetChat Получить доступный чат +// (GET /api/v1/chats/{chat_id}) +func (_ Unimplemented) GetChat(w http.ResponseWriter, r *http.Request, chatId openapi_types.UUID) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ListMessages Сообщения по (created_at, id) по возрастанию +// (GET /api/v1/chats/{chat_id}/messages) +func (_ Unimplemented) ListMessages(w http.ResponseWriter, r *http.Request, chatId openapi_types.UUID, params ListMessagesParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// CreateMessage Отправить сообщение +// (POST /api/v1/chats/{chat_id}/messages) +func (_ Unimplemented) CreateMessage(w http.ResponseWriter, r *http.Request, chatId openapi_types.UUID, params CreateMessageParams) { + w.WriteHeader(http.StatusNotImplemented) +} + +// RegisterUser Создать пользователя +// (POST /api/v1/users) +func (_ Unimplemented) RegisterUser(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// CurrentUser Текущий пользователь +// (GET /api/v1/users/me) +func (_ Unimplemented) CurrentUser(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Liveness Процесс жив +// (GET /health/live) +func (_ Unimplemented) Liveness(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Readiness Готов принимать трафик +// (GET /health/ready) +func (_ Unimplemented) Readiness(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + +// ServerInterfaceWrapper converts contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface + HandlerMiddlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +type MiddlewareFunc func(http.Handler) http.Handler + +// CreateSession operation middleware +func (siw *ServerInterfaceWrapper) CreateSession(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateSession(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// RevokeSession operation middleware +func (siw *ServerInterfaceWrapper) RevokeSession(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.RevokeSession(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ListChats operation middleware +func (siw *ServerInterfaceWrapper) ListChats(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // Parameter object where we will unmarshal all parameters from the context + var params ListChatsParams + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "limit", r.URL.Query(), ¶ms.Limit, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "limit"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "limit", Err: err}) + } + return + } + + // ------------- Optional query parameter "cursor" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "cursor", r.URL.Query(), ¶ms.Cursor, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "cursor"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "cursor", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ListChats(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateChat operation middleware +func (siw *ServerInterfaceWrapper) CreateChat(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateChat(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetChat operation middleware +func (siw *ServerInterfaceWrapper) GetChat(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "chat_id" ------------- + var chatId openapi_types.UUID + + err = runtime.BindStyledParameterWithOptions("simple", "chat_id", chi.URLParam(r, "chat_id"), &chatId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "uuid", ValueIsUnescaped: r.URL.RawPath == ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "chat_id", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetChat(w, r, chatId) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// ListMessages operation middleware +func (siw *ServerInterfaceWrapper) ListMessages(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "chat_id" ------------- + var chatId openapi_types.UUID + + err = runtime.BindStyledParameterWithOptions("simple", "chat_id", chi.URLParam(r, "chat_id"), &chatId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "uuid", ValueIsUnescaped: r.URL.RawPath == ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "chat_id", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params ListMessagesParams + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "limit", r.URL.Query(), ¶ms.Limit, runtime.BindQueryParameterOptions{Type: "integer", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "limit"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "limit", Err: err}) + } + return + } + + // ------------- Optional query parameter "cursor" ------------- + + err = runtime.BindQueryParameterWithOptions("form", true, false, "cursor", r.URL.Query(), ¶ms.Cursor, runtime.BindQueryParameterOptions{Type: "string", Format: ""}) + if err != nil { + var requiredError *runtime.RequiredParameterError + if errors.As(err, &requiredError) { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "cursor"}) + } else { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "cursor", Err: err}) + } + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ListMessages(w, r, chatId, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CreateMessage operation middleware +func (siw *ServerInterfaceWrapper) CreateMessage(w http.ResponseWriter, r *http.Request) { + + var err error + _ = err + + // ------------- Path parameter "chat_id" ------------- + var chatId openapi_types.UUID + + err = runtime.BindStyledParameterWithOptions("simple", "chat_id", chi.URLParam(r, "chat_id"), &chatId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "uuid", ValueIsUnescaped: r.URL.RawPath == ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "chat_id", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params CreateMessageParams + + headers := r.Header + + // ------------- Required header parameter "Idempotency-Key" ------------- + if valueList, found := headers[http.CanonicalHeaderKey("Idempotency-Key")]; found { + var IdempotencyKey string + n := len(valueList) + if n != 1 { + siw.ErrorHandlerFunc(w, r, &TooManyValuesForParamError{ParamName: "Idempotency-Key", Count: n}) + return + } + + err = runtime.BindStyledParameterWithOptions("simple", "Idempotency-Key", valueList[0], &IdempotencyKey, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: false, Required: true, Type: "string", Format: ""}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "Idempotency-Key", Err: err}) + return + } + + params.IdempotencyKey = IdempotencyKey + + } else { + err := fmt.Errorf("Header parameter Idempotency-Key is required, but not found") + siw.ErrorHandlerFunc(w, r, &RequiredHeaderError{ParamName: "Idempotency-Key", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreateMessage(w, r, chatId, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// RegisterUser operation middleware +func (siw *ServerInterfaceWrapper) RegisterUser(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.RegisterUser(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// CurrentUser operation middleware +func (siw *ServerInterfaceWrapper) CurrentUser(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CurrentUser(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// Liveness operation middleware +func (siw *ServerInterfaceWrapper) Liveness(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.Liveness(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// Readiness operation middleware +func (siw *ServerInterfaceWrapper) Readiness(w http.ResponseWriter, r *http.Request) { + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.Readiness(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string + Err error +} + +func (e *UnescapedCookieParamError) Error() string { + return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName) +} + +func (e *UnescapedCookieParamError) Unwrap() error { + return e.Err +} + +type UnmarshalingParamError struct { + ParamName string + Err error +} + +func (e *UnmarshalingParamError) Error() string { + return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error()) +} + +func (e *UnmarshalingParamError) Unwrap() error { + return e.Err +} + +type RequiredParamError struct { + ParamName string +} + +func (e *RequiredParamError) Error() string { + return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName) +} + +type RequiredHeaderError struct { + ParamName string + Err error +} + +func (e *RequiredHeaderError) Error() string { + return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName) +} + +func (e *RequiredHeaderError) Unwrap() error { + return e.Err +} + +type InvalidParamFormatError struct { + ParamName string + Err error +} + +func (e *InvalidParamFormatError) Error() string { + return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error()) +} + +func (e *InvalidParamFormatError) Unwrap() error { + return e.Err +} + +type TooManyValuesForParamError struct { + ParamName string + Count int +} + +func (e *TooManyValuesForParamError) Error() string { + return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count) +} + +// Handler creates http.Handler with routing matching OpenAPI spec. +func Handler(si ServerInterface) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{}) +} + +type ChiServerOptions struct { + BaseURL string + BaseRouter chi.Router + Middlewares []MiddlewareFunc + ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux. +func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseRouter: r, + }) +} + +func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler { + return HandlerWithOptions(si, ChiServerOptions{ + BaseURL: baseURL, + BaseRouter: r, + }) +} + +// HandlerWithOptions creates http.Handler with additional options +func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { + r := options.BaseRouter + + if r == nil { + r = chi.NewRouter() + } + if options.ErrorHandlerFunc == nil { + options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + wrapper := ServerInterfaceWrapper{ + Handler: si, + HandlerMiddlewares: options.Middlewares, + ErrorHandlerFunc: options.ErrorHandlerFunc, + } + + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/api/v1/auth/sessions", wrapper.CreateSession) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/api/v1/auth/sessions/current", wrapper.RevokeSession) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/api/v1/chats", wrapper.ListChats) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/api/v1/chats", wrapper.CreateChat) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/api/v1/chats/{chat_id}", wrapper.GetChat) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/api/v1/chats/{chat_id}/messages", wrapper.ListMessages) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/api/v1/chats/{chat_id}/messages", wrapper.CreateMessage) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/api/v1/users", wrapper.RegisterUser) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/api/v1/users/me", wrapper.CurrentUser) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/health/live", wrapper.Liveness) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/health/ready", wrapper.Readiness) + }) + + return r +} + +type CreateSessionRequestObject struct { +} + +type CreateSessionResponseObject interface { + VisitCreateSessionResponse(w http.ResponseWriter) error +} + +type CreateSession201ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CreateSession201JSONResponse struct { + Body Session + Headers CreateSession201ResponseHeaders +} + +func (response CreateSession201JSONResponse) VisitCreateSessionResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(201) + _, err := buf.WriteTo(w) + return err +} + +type CreateSession400ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CreateSession400JSONResponse struct { + Body Error + Headers CreateSession400ResponseHeaders +} + +func (response CreateSession400JSONResponse) VisitCreateSessionResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(400) + _, err := buf.WriteTo(w) + return err +} + +type CreateSession401ResponseHeaders struct { + WWWAuthenticate *string + XInstanceId *string + XRequestId *string +} + +type CreateSession401JSONResponse struct { + Body Error + Headers CreateSession401ResponseHeaders +} + +func (response CreateSession401JSONResponse) VisitCreateSessionResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.WWWAuthenticate != nil { + w.Header().Set("WWW-Authenticate", fmt.Sprint(*response.Headers.WWWAuthenticate)) + } + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(401) + _, err := buf.WriteTo(w) + return err +} + +type CreateSession429ResponseHeaders struct { + RetryAfter *int + XInstanceId *string + XRequestId *string +} + +type CreateSession429JSONResponse struct { + Body Error + Headers CreateSession429ResponseHeaders +} + +func (response CreateSession429JSONResponse) VisitCreateSessionResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.RetryAfter != nil { + w.Header().Set("Retry-After", fmt.Sprint(*response.Headers.RetryAfter)) + } + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(429) + _, err := buf.WriteTo(w) + return err +} + +type CreateSession500ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CreateSession500JSONResponse struct { + Body Error + Headers CreateSession500ResponseHeaders +} + +func (response CreateSession500JSONResponse) VisitCreateSessionResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(500) + _, err := buf.WriteTo(w) + return err +} + +type CreateSession503ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CreateSession503JSONResponse struct { + Body Error + Headers CreateSession503ResponseHeaders +} + +func (response CreateSession503JSONResponse) VisitCreateSessionResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(503) + _, err := buf.WriteTo(w) + return err +} + +type RevokeSessionRequestObject struct { +} + +type RevokeSessionResponseObject interface { + VisitRevokeSessionResponse(w http.ResponseWriter) error +} + +type RevokeSession204ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type RevokeSession204Response struct { + Headers RevokeSession204ResponseHeaders +} + +func (response RevokeSession204Response) VisitRevokeSessionResponse(w http.ResponseWriter) error { + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(204) + return nil +} + +type RevokeSession401ResponseHeaders struct { + WWWAuthenticate *string + XInstanceId *string + XRequestId *string +} + +type RevokeSession401JSONResponse struct { + Body Error + Headers RevokeSession401ResponseHeaders +} + +func (response RevokeSession401JSONResponse) VisitRevokeSessionResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.WWWAuthenticate != nil { + w.Header().Set("WWW-Authenticate", fmt.Sprint(*response.Headers.WWWAuthenticate)) + } + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(401) + _, err := buf.WriteTo(w) + return err +} + +type RevokeSession429ResponseHeaders struct { + RetryAfter *int + XInstanceId *string + XRequestId *string +} + +type RevokeSession429JSONResponse struct { + Body Error + Headers RevokeSession429ResponseHeaders +} + +func (response RevokeSession429JSONResponse) VisitRevokeSessionResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.RetryAfter != nil { + w.Header().Set("Retry-After", fmt.Sprint(*response.Headers.RetryAfter)) + } + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(429) + _, err := buf.WriteTo(w) + return err +} + +type RevokeSession500ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type RevokeSession500JSONResponse struct { + Body Error + Headers RevokeSession500ResponseHeaders +} + +func (response RevokeSession500JSONResponse) VisitRevokeSessionResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(500) + _, err := buf.WriteTo(w) + return err +} + +type RevokeSession503ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type RevokeSession503JSONResponse struct { + Body Error + Headers RevokeSession503ResponseHeaders +} + +func (response RevokeSession503JSONResponse) VisitRevokeSessionResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(503) + _, err := buf.WriteTo(w) + return err +} + +type ListChatsRequestObject struct { + Params ListChatsParams +} + +type ListChatsResponseObject interface { + VisitListChatsResponse(w http.ResponseWriter) error +} + +type ListChats200ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type ListChats200JSONResponse struct { + Body ChatPage + Headers ListChats200ResponseHeaders +} + +func (response ListChats200JSONResponse) VisitListChatsResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(200) + _, err := buf.WriteTo(w) + return err +} + +type ListChats400ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type ListChats400JSONResponse struct { + Body Error + Headers ListChats400ResponseHeaders +} + +func (response ListChats400JSONResponse) VisitListChatsResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(400) + _, err := buf.WriteTo(w) + return err +} + +type ListChats401ResponseHeaders struct { + WWWAuthenticate *string + XInstanceId *string + XRequestId *string +} + +type ListChats401JSONResponse struct { + Body Error + Headers ListChats401ResponseHeaders +} + +func (response ListChats401JSONResponse) VisitListChatsResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.WWWAuthenticate != nil { + w.Header().Set("WWW-Authenticate", fmt.Sprint(*response.Headers.WWWAuthenticate)) + } + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(401) + _, err := buf.WriteTo(w) + return err +} + +type ListChats404ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type ListChats404JSONResponse struct { + Body Error + Headers ListChats404ResponseHeaders +} + +func (response ListChats404JSONResponse) VisitListChatsResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(404) + _, err := buf.WriteTo(w) + return err +} + +type ListChats409ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type ListChats409JSONResponse struct { + Body Error + Headers ListChats409ResponseHeaders +} + +func (response ListChats409JSONResponse) VisitListChatsResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(409) + _, err := buf.WriteTo(w) + return err +} + +type ListChats429ResponseHeaders struct { + RetryAfter *int + XInstanceId *string + XRequestId *string +} + +type ListChats429JSONResponse struct { + Body Error + Headers ListChats429ResponseHeaders +} + +func (response ListChats429JSONResponse) VisitListChatsResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.RetryAfter != nil { + w.Header().Set("Retry-After", fmt.Sprint(*response.Headers.RetryAfter)) + } + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(429) + _, err := buf.WriteTo(w) + return err +} + +type ListChats500ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type ListChats500JSONResponse struct { + Body Error + Headers ListChats500ResponseHeaders +} + +func (response ListChats500JSONResponse) VisitListChatsResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(500) + _, err := buf.WriteTo(w) + return err +} + +type ListChats503ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type ListChats503JSONResponse struct { + Body Error + Headers ListChats503ResponseHeaders +} + +func (response ListChats503JSONResponse) VisitListChatsResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(503) + _, err := buf.WriteTo(w) + return err +} + +type CreateChatRequestObject struct { + Body *CreateChatJSONRequestBody +} + +type CreateChatResponseObject interface { + VisitCreateChatResponse(w http.ResponseWriter) error +} + +type CreateChat201ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CreateChat201JSONResponse struct { + Body Chat + Headers CreateChat201ResponseHeaders +} + +func (response CreateChat201JSONResponse) VisitCreateChatResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(201) + _, err := buf.WriteTo(w) + return err +} + +type CreateChat400ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CreateChat400JSONResponse struct { + Body Error + Headers CreateChat400ResponseHeaders +} + +func (response CreateChat400JSONResponse) VisitCreateChatResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(400) + _, err := buf.WriteTo(w) + return err +} + +type CreateChat401ResponseHeaders struct { + WWWAuthenticate *string + XInstanceId *string + XRequestId *string +} + +type CreateChat401JSONResponse struct { + Body Error + Headers CreateChat401ResponseHeaders +} + +func (response CreateChat401JSONResponse) VisitCreateChatResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.WWWAuthenticate != nil { + w.Header().Set("WWW-Authenticate", fmt.Sprint(*response.Headers.WWWAuthenticate)) + } + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(401) + _, err := buf.WriteTo(w) + return err +} + +type CreateChat404ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CreateChat404JSONResponse struct { + Body Error + Headers CreateChat404ResponseHeaders +} + +func (response CreateChat404JSONResponse) VisitCreateChatResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(404) + _, err := buf.WriteTo(w) + return err +} + +type CreateChat409ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CreateChat409JSONResponse struct { + Body Error + Headers CreateChat409ResponseHeaders +} + +func (response CreateChat409JSONResponse) VisitCreateChatResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(409) + _, err := buf.WriteTo(w) + return err +} + +type CreateChat429ResponseHeaders struct { + RetryAfter *int + XInstanceId *string + XRequestId *string +} + +type CreateChat429JSONResponse struct { + Body Error + Headers CreateChat429ResponseHeaders +} + +func (response CreateChat429JSONResponse) VisitCreateChatResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.RetryAfter != nil { + w.Header().Set("Retry-After", fmt.Sprint(*response.Headers.RetryAfter)) + } + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(429) + _, err := buf.WriteTo(w) + return err +} + +type CreateChat500ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CreateChat500JSONResponse struct { + Body Error + Headers CreateChat500ResponseHeaders +} + +func (response CreateChat500JSONResponse) VisitCreateChatResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(500) + _, err := buf.WriteTo(w) + return err +} + +type CreateChat503ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CreateChat503JSONResponse struct { + Body Error + Headers CreateChat503ResponseHeaders +} + +func (response CreateChat503JSONResponse) VisitCreateChatResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(503) + _, err := buf.WriteTo(w) + return err +} + +type GetChatRequestObject struct { + ChatId openapi_types.UUID `json:"chat_id"` +} + +type GetChatResponseObject interface { + VisitGetChatResponse(w http.ResponseWriter) error +} + +type GetChat200ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type GetChat200JSONResponse struct { + Body Chat + Headers GetChat200ResponseHeaders +} + +func (response GetChat200JSONResponse) VisitGetChatResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(200) + _, err := buf.WriteTo(w) + return err +} + +type GetChat400ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type GetChat400JSONResponse struct { + Body Error + Headers GetChat400ResponseHeaders +} + +func (response GetChat400JSONResponse) VisitGetChatResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(400) + _, err := buf.WriteTo(w) + return err +} + +type GetChat401ResponseHeaders struct { + WWWAuthenticate *string + XInstanceId *string + XRequestId *string +} + +type GetChat401JSONResponse struct { + Body Error + Headers GetChat401ResponseHeaders +} + +func (response GetChat401JSONResponse) VisitGetChatResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.WWWAuthenticate != nil { + w.Header().Set("WWW-Authenticate", fmt.Sprint(*response.Headers.WWWAuthenticate)) + } + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(401) + _, err := buf.WriteTo(w) + return err +} + +type GetChat404ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type GetChat404JSONResponse struct { + Body Error + Headers GetChat404ResponseHeaders +} + +func (response GetChat404JSONResponse) VisitGetChatResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(404) + _, err := buf.WriteTo(w) + return err +} + +type GetChat409ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type GetChat409JSONResponse struct { + Body Error + Headers GetChat409ResponseHeaders +} + +func (response GetChat409JSONResponse) VisitGetChatResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(409) + _, err := buf.WriteTo(w) + return err +} + +type GetChat429ResponseHeaders struct { + RetryAfter *int + XInstanceId *string + XRequestId *string +} + +type GetChat429JSONResponse struct { + Body Error + Headers GetChat429ResponseHeaders +} + +func (response GetChat429JSONResponse) VisitGetChatResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.RetryAfter != nil { + w.Header().Set("Retry-After", fmt.Sprint(*response.Headers.RetryAfter)) + } + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(429) + _, err := buf.WriteTo(w) + return err +} + +type GetChat500ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type GetChat500JSONResponse struct { + Body Error + Headers GetChat500ResponseHeaders +} + +func (response GetChat500JSONResponse) VisitGetChatResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(500) + _, err := buf.WriteTo(w) + return err +} + +type GetChat503ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type GetChat503JSONResponse struct { + Body Error + Headers GetChat503ResponseHeaders +} + +func (response GetChat503JSONResponse) VisitGetChatResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(503) + _, err := buf.WriteTo(w) + return err +} + +type ListMessagesRequestObject struct { + ChatId openapi_types.UUID `json:"chat_id"` + Params ListMessagesParams +} + +type ListMessagesResponseObject interface { + VisitListMessagesResponse(w http.ResponseWriter) error +} + +type ListMessages200ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type ListMessages200JSONResponse struct { + Body MessagePage + Headers ListMessages200ResponseHeaders +} + +func (response ListMessages200JSONResponse) VisitListMessagesResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(200) + _, err := buf.WriteTo(w) + return err +} + +type ListMessages400ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type ListMessages400JSONResponse struct { + Body Error + Headers ListMessages400ResponseHeaders +} + +func (response ListMessages400JSONResponse) VisitListMessagesResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(400) + _, err := buf.WriteTo(w) + return err +} + +type ListMessages401ResponseHeaders struct { + WWWAuthenticate *string + XInstanceId *string + XRequestId *string +} + +type ListMessages401JSONResponse struct { + Body Error + Headers ListMessages401ResponseHeaders +} + +func (response ListMessages401JSONResponse) VisitListMessagesResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.WWWAuthenticate != nil { + w.Header().Set("WWW-Authenticate", fmt.Sprint(*response.Headers.WWWAuthenticate)) + } + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(401) + _, err := buf.WriteTo(w) + return err +} + +type ListMessages404ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type ListMessages404JSONResponse struct { + Body Error + Headers ListMessages404ResponseHeaders +} + +func (response ListMessages404JSONResponse) VisitListMessagesResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(404) + _, err := buf.WriteTo(w) + return err +} + +type ListMessages409ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type ListMessages409JSONResponse struct { + Body Error + Headers ListMessages409ResponseHeaders +} + +func (response ListMessages409JSONResponse) VisitListMessagesResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(409) + _, err := buf.WriteTo(w) + return err +} + +type ListMessages429ResponseHeaders struct { + RetryAfter *int + XInstanceId *string + XRequestId *string +} + +type ListMessages429JSONResponse struct { + Body Error + Headers ListMessages429ResponseHeaders +} + +func (response ListMessages429JSONResponse) VisitListMessagesResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.RetryAfter != nil { + w.Header().Set("Retry-After", fmt.Sprint(*response.Headers.RetryAfter)) + } + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(429) + _, err := buf.WriteTo(w) + return err +} + +type ListMessages500ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type ListMessages500JSONResponse struct { + Body Error + Headers ListMessages500ResponseHeaders +} + +func (response ListMessages500JSONResponse) VisitListMessagesResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(500) + _, err := buf.WriteTo(w) + return err +} + +type ListMessages503ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type ListMessages503JSONResponse struct { + Body Error + Headers ListMessages503ResponseHeaders +} + +func (response ListMessages503JSONResponse) VisitListMessagesResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(503) + _, err := buf.WriteTo(w) + return err +} + +type CreateMessageRequestObject struct { + ChatId openapi_types.UUID `json:"chat_id"` + Params CreateMessageParams + Body *CreateMessageJSONRequestBody +} + +type CreateMessageResponseObject interface { + VisitCreateMessageResponse(w http.ResponseWriter) error +} + +type CreateMessage201ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CreateMessage201JSONResponse struct { + Body Message + Headers CreateMessage201ResponseHeaders +} + +func (response CreateMessage201JSONResponse) VisitCreateMessageResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(201) + _, err := buf.WriteTo(w) + return err +} + +type CreateMessage400ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CreateMessage400JSONResponse struct { + Body Error + Headers CreateMessage400ResponseHeaders +} + +func (response CreateMessage400JSONResponse) VisitCreateMessageResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(400) + _, err := buf.WriteTo(w) + return err +} + +type CreateMessage401ResponseHeaders struct { + WWWAuthenticate *string + XInstanceId *string + XRequestId *string +} + +type CreateMessage401JSONResponse struct { + Body Error + Headers CreateMessage401ResponseHeaders +} + +func (response CreateMessage401JSONResponse) VisitCreateMessageResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.WWWAuthenticate != nil { + w.Header().Set("WWW-Authenticate", fmt.Sprint(*response.Headers.WWWAuthenticate)) + } + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(401) + _, err := buf.WriteTo(w) + return err +} + +type CreateMessage404ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CreateMessage404JSONResponse struct { + Body Error + Headers CreateMessage404ResponseHeaders +} + +func (response CreateMessage404JSONResponse) VisitCreateMessageResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(404) + _, err := buf.WriteTo(w) + return err +} + +type CreateMessage409ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CreateMessage409JSONResponse struct { + Body Error + Headers CreateMessage409ResponseHeaders +} + +func (response CreateMessage409JSONResponse) VisitCreateMessageResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(409) + _, err := buf.WriteTo(w) + return err +} + +type CreateMessage429ResponseHeaders struct { + RetryAfter *int + XInstanceId *string + XRequestId *string +} + +type CreateMessage429JSONResponse struct { + Body Error + Headers CreateMessage429ResponseHeaders +} + +func (response CreateMessage429JSONResponse) VisitCreateMessageResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.RetryAfter != nil { + w.Header().Set("Retry-After", fmt.Sprint(*response.Headers.RetryAfter)) + } + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(429) + _, err := buf.WriteTo(w) + return err +} + +type CreateMessage500ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CreateMessage500JSONResponse struct { + Body Error + Headers CreateMessage500ResponseHeaders +} + +func (response CreateMessage500JSONResponse) VisitCreateMessageResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(500) + _, err := buf.WriteTo(w) + return err +} + +type CreateMessage503ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CreateMessage503JSONResponse struct { + Body Error + Headers CreateMessage503ResponseHeaders +} + +func (response CreateMessage503JSONResponse) VisitCreateMessageResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(503) + _, err := buf.WriteTo(w) + return err +} + +type RegisterUserRequestObject struct { + Body *RegisterUserJSONRequestBody +} + +type RegisterUserResponseObject interface { + VisitRegisterUserResponse(w http.ResponseWriter) error +} + +type RegisterUser201ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type RegisterUser201JSONResponse struct { + Body User + Headers RegisterUser201ResponseHeaders +} + +func (response RegisterUser201JSONResponse) VisitRegisterUserResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(201) + _, err := buf.WriteTo(w) + return err +} + +type RegisterUser400ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type RegisterUser400JSONResponse struct { + Body Error + Headers RegisterUser400ResponseHeaders +} + +func (response RegisterUser400JSONResponse) VisitRegisterUserResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(400) + _, err := buf.WriteTo(w) + return err +} + +type RegisterUser409ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type RegisterUser409JSONResponse struct { + Body Error + Headers RegisterUser409ResponseHeaders +} + +func (response RegisterUser409JSONResponse) VisitRegisterUserResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(409) + _, err := buf.WriteTo(w) + return err +} + +type RegisterUser429ResponseHeaders struct { + RetryAfter *int + XInstanceId *string + XRequestId *string +} + +type RegisterUser429JSONResponse struct { + Body Error + Headers RegisterUser429ResponseHeaders +} + +func (response RegisterUser429JSONResponse) VisitRegisterUserResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.RetryAfter != nil { + w.Header().Set("Retry-After", fmt.Sprint(*response.Headers.RetryAfter)) + } + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(429) + _, err := buf.WriteTo(w) + return err +} + +type RegisterUser500ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type RegisterUser500JSONResponse struct { + Body Error + Headers RegisterUser500ResponseHeaders +} + +func (response RegisterUser500JSONResponse) VisitRegisterUserResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(500) + _, err := buf.WriteTo(w) + return err +} + +type RegisterUser503ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type RegisterUser503JSONResponse struct { + Body Error + Headers RegisterUser503ResponseHeaders +} + +func (response RegisterUser503JSONResponse) VisitRegisterUserResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(503) + _, err := buf.WriteTo(w) + return err +} + +type CurrentUserRequestObject struct { +} + +type CurrentUserResponseObject interface { + VisitCurrentUserResponse(w http.ResponseWriter) error +} + +type CurrentUser200ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CurrentUser200JSONResponse struct { + Body User + Headers CurrentUser200ResponseHeaders +} + +func (response CurrentUser200JSONResponse) VisitCurrentUserResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(200) + _, err := buf.WriteTo(w) + return err +} + +type CurrentUser400ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CurrentUser400JSONResponse struct { + Body Error + Headers CurrentUser400ResponseHeaders +} + +func (response CurrentUser400JSONResponse) VisitCurrentUserResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(400) + _, err := buf.WriteTo(w) + return err +} + +type CurrentUser401ResponseHeaders struct { + WWWAuthenticate *string + XInstanceId *string + XRequestId *string +} + +type CurrentUser401JSONResponse struct { + Body Error + Headers CurrentUser401ResponseHeaders +} + +func (response CurrentUser401JSONResponse) VisitCurrentUserResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.WWWAuthenticate != nil { + w.Header().Set("WWW-Authenticate", fmt.Sprint(*response.Headers.WWWAuthenticate)) + } + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(401) + _, err := buf.WriteTo(w) + return err +} + +type CurrentUser404ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CurrentUser404JSONResponse struct { + Body Error + Headers CurrentUser404ResponseHeaders +} + +func (response CurrentUser404JSONResponse) VisitCurrentUserResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(404) + _, err := buf.WriteTo(w) + return err +} + +type CurrentUser409ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CurrentUser409JSONResponse struct { + Body Error + Headers CurrentUser409ResponseHeaders +} + +func (response CurrentUser409JSONResponse) VisitCurrentUserResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(409) + _, err := buf.WriteTo(w) + return err +} + +type CurrentUser429ResponseHeaders struct { + RetryAfter *int + XInstanceId *string + XRequestId *string +} + +type CurrentUser429JSONResponse struct { + Body Error + Headers CurrentUser429ResponseHeaders +} + +func (response CurrentUser429JSONResponse) VisitCurrentUserResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.RetryAfter != nil { + w.Header().Set("Retry-After", fmt.Sprint(*response.Headers.RetryAfter)) + } + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(429) + _, err := buf.WriteTo(w) + return err +} + +type CurrentUser500ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CurrentUser500JSONResponse struct { + Body Error + Headers CurrentUser500ResponseHeaders +} + +func (response CurrentUser500JSONResponse) VisitCurrentUserResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(500) + _, err := buf.WriteTo(w) + return err +} + +type CurrentUser503ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type CurrentUser503JSONResponse struct { + Body Error + Headers CurrentUser503ResponseHeaders +} + +func (response CurrentUser503JSONResponse) VisitCurrentUserResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(503) + _, err := buf.WriteTo(w) + return err +} + +type LivenessRequestObject struct { +} + +type LivenessResponseObject interface { + VisitLivenessResponse(w http.ResponseWriter) error +} + +type Liveness200ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type Liveness200JSONResponse struct { + Body Health + Headers Liveness200ResponseHeaders +} + +func (response Liveness200JSONResponse) VisitLivenessResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(200) + _, err := buf.WriteTo(w) + return err +} + +type Liveness500ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type Liveness500JSONResponse struct { + Body Error + Headers Liveness500ResponseHeaders +} + +func (response Liveness500JSONResponse) VisitLivenessResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(500) + _, err := buf.WriteTo(w) + return err +} + +type ReadinessRequestObject struct { +} + +type ReadinessResponseObject interface { + VisitReadinessResponse(w http.ResponseWriter) error +} + +type Readiness200ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type Readiness200JSONResponse struct { + Body Health + Headers Readiness200ResponseHeaders +} + +func (response Readiness200JSONResponse) VisitReadinessResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(200) + _, err := buf.WriteTo(w) + return err +} + +type Readiness500ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type Readiness500JSONResponse struct { + Body Error + Headers Readiness500ResponseHeaders +} + +func (response Readiness500JSONResponse) VisitReadinessResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(500) + _, err := buf.WriteTo(w) + return err +} + +type Readiness503ResponseHeaders struct { + XInstanceId *string + XRequestId *string +} + +type Readiness503JSONResponse struct { + Body Error + Headers Readiness503ResponseHeaders +} + +func (response Readiness503JSONResponse) VisitReadinessResponse(w http.ResponseWriter) error { + + var buf bytes.Buffer + if err := json.NewEncoder(&buf).Encode(response.Body); err != nil { + return err + } + w.Header().Set("Content-Type", "application/json") + if response.Headers.XInstanceId != nil { + w.Header().Set("X-Instance-Id", fmt.Sprint(*response.Headers.XInstanceId)) + } + if response.Headers.XRequestId != nil { + w.Header().Set("X-Request-Id", fmt.Sprint(*response.Headers.XRequestId)) + } + w.WriteHeader(503) + _, err := buf.WriteTo(w) + return err +} + +// StrictServerInterface represents all server handlers. +type StrictServerInterface interface { + // CreateSession Вход: Basic username:password; выдаёт сессию + // (POST /api/v1/auth/sessions) + CreateSession(ctx context.Context, request CreateSessionRequestObject) (CreateSessionResponseObject, error) + // RevokeSession Отозвать текущую сессию + // (DELETE /api/v1/auth/sessions/current) + RevokeSession(ctx context.Context, request RevokeSessionRequestObject) (RevokeSessionResponseObject, error) + // ListChats Чаты текущего пользователя + // (GET /api/v1/chats) + ListChats(ctx context.Context, request ListChatsRequestObject) (ListChatsResponseObject, error) + // CreateChat Создать чат; вызывающий должен входить в member_ids + // (POST /api/v1/chats) + CreateChat(ctx context.Context, request CreateChatRequestObject) (CreateChatResponseObject, error) + // GetChat Получить доступный чат + // (GET /api/v1/chats/{chat_id}) + GetChat(ctx context.Context, request GetChatRequestObject) (GetChatResponseObject, error) + // ListMessages Сообщения по (created_at, id) по возрастанию + // (GET /api/v1/chats/{chat_id}/messages) + ListMessages(ctx context.Context, request ListMessagesRequestObject) (ListMessagesResponseObject, error) + // CreateMessage Отправить сообщение + // (POST /api/v1/chats/{chat_id}/messages) + CreateMessage(ctx context.Context, request CreateMessageRequestObject) (CreateMessageResponseObject, error) + // RegisterUser Создать пользователя + // (POST /api/v1/users) + RegisterUser(ctx context.Context, request RegisterUserRequestObject) (RegisterUserResponseObject, error) + // CurrentUser Текущий пользователь + // (GET /api/v1/users/me) + CurrentUser(ctx context.Context, request CurrentUserRequestObject) (CurrentUserResponseObject, error) + // Liveness Процесс жив + // (GET /health/live) + Liveness(ctx context.Context, request LivenessRequestObject) (LivenessResponseObject, error) + // Readiness Готов принимать трафик + // (GET /health/ready) + Readiness(ctx context.Context, request ReadinessRequestObject) (ReadinessResponseObject, error) +} + +type StrictHandlerFunc func(ctx context.Context, w http.ResponseWriter, r *http.Request, request any) (any, error) +type StrictMiddlewareFunc func(f StrictHandlerFunc, operationID string) StrictHandlerFunc + +type StrictHTTPServerOptions struct { + RequestErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) + ResponseErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) +} + +func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface { + return &strictHandler{ssi: ssi, middlewares: middlewares, options: StrictHTTPServerOptions{ + RequestErrorHandlerFunc: func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + }, + ResponseErrorHandlerFunc: func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusInternalServerError) + }, + }} +} + +func NewStrictHandlerWithOptions(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc, options StrictHTTPServerOptions) ServerInterface { + if options.RequestErrorHandlerFunc == nil { + options.RequestErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusBadRequest) + } + } + if options.ResponseErrorHandlerFunc == nil { + options.ResponseErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) { + http.Error(w, err.Error(), http.StatusInternalServerError) + } + } + return &strictHandler{ssi: ssi, middlewares: middlewares, options: options} +} + +type strictHandler struct { + ssi StrictServerInterface + middlewares []StrictMiddlewareFunc + options StrictHTTPServerOptions +} + +// CreateSession operation middleware +func (sh *strictHandler) CreateSession(w http.ResponseWriter, r *http.Request) { + var request CreateSessionRequestObject + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.CreateSession(ctx, request.(CreateSessionRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "CreateSession") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(CreateSessionResponseObject); ok { + if err := validResponse.VisitCreateSessionResponse(w); err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } + } else if response != nil { + sh.options.ResponseErrorHandlerFunc(w, r, fmt.Errorf("unexpected response type: %T", response)) + } +} + +// RevokeSession operation middleware +func (sh *strictHandler) RevokeSession(w http.ResponseWriter, r *http.Request) { + var request RevokeSessionRequestObject + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.RevokeSession(ctx, request.(RevokeSessionRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "RevokeSession") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(RevokeSessionResponseObject); ok { + if err := validResponse.VisitRevokeSessionResponse(w); err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } + } else if response != nil { + sh.options.ResponseErrorHandlerFunc(w, r, fmt.Errorf("unexpected response type: %T", response)) + } +} + +// ListChats operation middleware +func (sh *strictHandler) ListChats(w http.ResponseWriter, r *http.Request, params ListChatsParams) { + var request ListChatsRequestObject + + request.Params = params + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.ListChats(ctx, request.(ListChatsRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "ListChats") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(ListChatsResponseObject); ok { + if err := validResponse.VisitListChatsResponse(w); err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } + } else if response != nil { + sh.options.ResponseErrorHandlerFunc(w, r, fmt.Errorf("unexpected response type: %T", response)) + } +} + +// CreateChat operation middleware +func (sh *strictHandler) CreateChat(w http.ResponseWriter, r *http.Request) { + var request CreateChatRequestObject + + var body CreateChatJSONRequestBody + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + sh.options.RequestErrorHandlerFunc(w, r, fmt.Errorf("can't decode JSON body: %w", err)) + return + } + request.Body = &body + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.CreateChat(ctx, request.(CreateChatRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "CreateChat") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(CreateChatResponseObject); ok { + if err := validResponse.VisitCreateChatResponse(w); err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } + } else if response != nil { + sh.options.ResponseErrorHandlerFunc(w, r, fmt.Errorf("unexpected response type: %T", response)) + } +} + +// GetChat operation middleware +func (sh *strictHandler) GetChat(w http.ResponseWriter, r *http.Request, chatId openapi_types.UUID) { + var request GetChatRequestObject + + request.ChatId = chatId + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.GetChat(ctx, request.(GetChatRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "GetChat") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(GetChatResponseObject); ok { + if err := validResponse.VisitGetChatResponse(w); err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } + } else if response != nil { + sh.options.ResponseErrorHandlerFunc(w, r, fmt.Errorf("unexpected response type: %T", response)) + } +} + +// ListMessages operation middleware +func (sh *strictHandler) ListMessages(w http.ResponseWriter, r *http.Request, chatId openapi_types.UUID, params ListMessagesParams) { + var request ListMessagesRequestObject + + request.ChatId = chatId + request.Params = params + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.ListMessages(ctx, request.(ListMessagesRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "ListMessages") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(ListMessagesResponseObject); ok { + if err := validResponse.VisitListMessagesResponse(w); err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } + } else if response != nil { + sh.options.ResponseErrorHandlerFunc(w, r, fmt.Errorf("unexpected response type: %T", response)) + } +} + +// CreateMessage operation middleware +func (sh *strictHandler) CreateMessage(w http.ResponseWriter, r *http.Request, chatId openapi_types.UUID, params CreateMessageParams) { + var request CreateMessageRequestObject + + request.ChatId = chatId + request.Params = params + + var body CreateMessageJSONRequestBody + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + sh.options.RequestErrorHandlerFunc(w, r, fmt.Errorf("can't decode JSON body: %w", err)) + return + } + request.Body = &body + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.CreateMessage(ctx, request.(CreateMessageRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "CreateMessage") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(CreateMessageResponseObject); ok { + if err := validResponse.VisitCreateMessageResponse(w); err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } + } else if response != nil { + sh.options.ResponseErrorHandlerFunc(w, r, fmt.Errorf("unexpected response type: %T", response)) + } +} + +// RegisterUser operation middleware +func (sh *strictHandler) RegisterUser(w http.ResponseWriter, r *http.Request) { + var request RegisterUserRequestObject + + var body RegisterUserJSONRequestBody + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + sh.options.RequestErrorHandlerFunc(w, r, fmt.Errorf("can't decode JSON body: %w", err)) + return + } + request.Body = &body + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.RegisterUser(ctx, request.(RegisterUserRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "RegisterUser") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(RegisterUserResponseObject); ok { + if err := validResponse.VisitRegisterUserResponse(w); err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } + } else if response != nil { + sh.options.ResponseErrorHandlerFunc(w, r, fmt.Errorf("unexpected response type: %T", response)) + } +} + +// CurrentUser operation middleware +func (sh *strictHandler) CurrentUser(w http.ResponseWriter, r *http.Request) { + var request CurrentUserRequestObject + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.CurrentUser(ctx, request.(CurrentUserRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "CurrentUser") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(CurrentUserResponseObject); ok { + if err := validResponse.VisitCurrentUserResponse(w); err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } + } else if response != nil { + sh.options.ResponseErrorHandlerFunc(w, r, fmt.Errorf("unexpected response type: %T", response)) + } +} + +// Liveness operation middleware +func (sh *strictHandler) Liveness(w http.ResponseWriter, r *http.Request) { + var request LivenessRequestObject + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.Liveness(ctx, request.(LivenessRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "Liveness") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(LivenessResponseObject); ok { + if err := validResponse.VisitLivenessResponse(w); err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } + } else if response != nil { + sh.options.ResponseErrorHandlerFunc(w, r, fmt.Errorf("unexpected response type: %T", response)) + } +} + +// Readiness operation middleware +func (sh *strictHandler) Readiness(w http.ResponseWriter, r *http.Request) { + var request ReadinessRequestObject + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.Readiness(ctx, request.(ReadinessRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "Readiness") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(ReadinessResponseObject); ok { + if err := validResponse.VisitReadinessResponse(w); err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } + } else if response != nil { + sh.options.ResponseErrorHandlerFunc(w, r, fmt.Errorf("unexpected response type: %T", response)) + } +} diff --git a/backend/internal/adapter/handler/api.go b/backend/internal/adapter/handler/api.go new file mode 100644 index 00000000..202258c9 --- /dev/null +++ b/backend/internal/adapter/handler/api.go @@ -0,0 +1,102 @@ +package handler + +import ( + "context" + "net/http" + + "backend/internal/domain/model" +) + +// Реализация StrictServerInterface: вызвать use-case и перевести результат в +// API-модели. Ошибки уходят в writeError, он один решает про HTTP-статус. + +func (h *API) Liveness(context.Context, LivenessRequestObject) (LivenessResponseObject, error) { + return Liveness200JSONResponse{Body: Health{Status: Ok}}, nil +} + +// Readiness rejects draining instances and unavailable required dependencies. +func (h *API) Readiness(ctx context.Context, _ ReadinessRequestObject) (ReadinessResponseObject, error) { + if !h.ready.Load() { + return nil, errDraining + } + if err := h.probe(ctx); err != nil { + return nil, model.ErrUnavailable + } + return Readiness200JSONResponse{Body: Health{Status: Ok}}, nil +} + +func (h *API) RegisterUser(ctx context.Context, req RegisterUserRequestObject) (RegisterUserResponseObject, error) { + if req.Body.Password == nil { + return nil, &model.ValidationError{Message: "password is required"} + } + user, err := h.auth.Register(ctx, req.Body.Username, req.Body.DisplayName, *req.Body.Password) + if err != nil { + return nil, err + } + return RegisterUser201JSONResponse{Body: toUser(user)}, nil +} + +func (h *API) CurrentUser(ctx context.Context, _ CurrentUserRequestObject) (CurrentUserResponseObject, error) { + return CurrentUser200JSONResponse{Body: toUser(currentUser(ctx))}, nil +} + +func (h *API) CreateChat(ctx context.Context, req CreateChatRequestObject) (CreateChatResponseObject, error) { + chat, err := h.app.CreateChat(ctx, currentUser(ctx).ID, req.Body.Title, req.Body.MemberIds) + if err != nil { + return nil, err + } + return CreateChat201JSONResponse{Body: toChat(chat)}, nil +} + +func (h *API) ListChats(ctx context.Context, req ListChatsRequestObject) (ListChatsResponseObject, error) { + page, err := h.app.ListChats(ctx, currentUser(ctx).ID, req.Params.Limit, req.Params.Cursor) + if err != nil { + return nil, err + } + return ListChats200JSONResponse{Body: ChatPage{Items: mapAll(page.Items, toChat), NextCursor: page.NextCursor}}, nil +} + +func (h *API) GetChat(ctx context.Context, req GetChatRequestObject) (GetChatResponseObject, error) { + chat, err := h.app.GetChat(ctx, currentUser(ctx).ID, req.ChatId) + if err != nil { + return nil, err + } + return GetChat200JSONResponse{Body: toChat(chat)}, nil +} + +func (h *API) CreateMessage(ctx context.Context, req CreateMessageRequestObject) (CreateMessageResponseObject, error) { + r := ctx.Value(sessionRequestKey{}).(*http.Request) + msg, err := h.app.SendMessage(ctx, currentUser(ctx).ID, req.ChatId, req.Body.Text, r.Header.Get("Idempotency-Key")) + if err != nil { + return nil, err + } + return CreateMessage201JSONResponse{Body: toMessage(msg)}, nil +} + +func (h *API) ListMessages(ctx context.Context, req ListMessagesRequestObject) (ListMessagesResponseObject, error) { + page, err := h.app.ListMessages(ctx, currentUser(ctx).ID, req.ChatId, req.Params.Limit, req.Params.Cursor) + if err != nil { + return nil, err + } + return ListMessages200JSONResponse{Body: MessagePage{Items: mapAll(page.Items, toMessage), NextCursor: page.NextCursor}}, nil +} + +func toUser(u model.User) User { + return User{Id: u.ID, Username: u.Username, DisplayName: u.DisplayName, CreatedAt: Timestamp(u.CreatedAt)} +} + +func toChat(c model.Chat) Chat { + return Chat{Id: c.ID, Title: c.Title, MemberIds: c.MemberIDs, CreatedAt: Timestamp(c.CreatedAt)} +} + +func toMessage(m model.Message) Message { + return Message{Id: m.ID, ChatId: m.ChatID, SenderId: m.SenderID, Text: m.Text, CreatedAt: Timestamp(m.CreatedAt)} +} + +func mapAll[T, R any](items []T, f func(T) R) []R { + out := make([]R, len(items)) + for i, item := range items { + out[i] = f(item) + } + return out +} diff --git a/backend/internal/adapter/handler/auth.go b/backend/internal/adapter/handler/auth.go new file mode 100644 index 00000000..84037c86 --- /dev/null +++ b/backend/internal/adapter/handler/auth.go @@ -0,0 +1,43 @@ +package handler + +import ( + "backend/internal/domain/model" + "context" + "net/http" + "strings" + "time" + "unicode/utf8" +) + +type sessionRequestKey struct{} + +func (h *API) CreateSession(ctx context.Context, _ CreateSessionRequestObject) (CreateSessionResponseObject, error) { + r := ctx.Value(sessionRequestKey{}).(*http.Request) + username, password, ok := r.BasicAuth() + if !ok || len(username) > 32 || len(password) > 512 || utf8.RuneCountInString(password) > 128 { + return nil, model.ErrUnauthorized + } + s, err := h.auth.Login(ctx, username, password) + if err != nil { + return nil, err + } + return CreateSession201JSONResponse{Body: Session{Token: s.Token, TokenType: Bearer, ExpiresAt: Timestamp(s.ExpiresAt), User: toUser(s.User)}}, nil +} +func (h *API) RevokeSession(ctx context.Context, _ RevokeSessionRequestObject) (RevokeSessionResponseObject, error) { + r := ctx.Value(sessionRequestKey{}).(*http.Request) + parts := strings.Fields(r.Header.Get("Authorization")) + if err := h.auth.Logout(ctx, parts[1]); err != nil { + return nil, err + } + return RevokeSession204Response{}, nil +} +func (h *API) requestContext(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ctx, cancel := context.WithTimeout(r.Context(), 5*time.Second) + defer cancel() + if r.URL.Path == "/api/v1/auth/sessions" { + w.Header().Set("WWW-Authenticate", `Basic realm="messenger", charset="UTF-8"`) + } + next.ServeHTTP(w, r.WithContext(context.WithValue(ctx, sessionRequestKey{}, r))) + }) +} diff --git a/backend/internal/adapter/handler/errors.go b/backend/internal/adapter/handler/errors.go new file mode 100644 index 00000000..af68bbf6 --- /dev/null +++ b/backend/internal/adapter/handler/errors.go @@ -0,0 +1,82 @@ +package handler + +import ( + "encoding/json" + "errors" + "net/http" + + "backend/internal/domain/model" +) + +var ( + errRouteNotFound = errors.New("route not found") + errMethodNotAllowed = errors.New("method not allowed") + errPayloadTooLarge = errors.New("payload too large") + errOverloaded = errors.New("overloaded") + errDraining = errors.New("draining") +) + +type apiError struct { + status int + code ErrorErrorCode + message string +} + +// classify — единственное место, где ошибка превращается в HTTP-статус. +func classify(err error) apiError { + var invalid *model.ValidationError + switch { + case errors.As(err, &invalid): + return apiError{http.StatusBadRequest, InvalidRequest, invalid.Message} + case errors.Is(err, model.ErrUnauthorized): + return apiError{http.StatusUnauthorized, Unauthorized, "нужна действующая сессия"} + case errors.Is(err, model.ErrNotFound), errors.Is(err, errRouteNotFound): + return apiError{http.StatusNotFound, NotFound, "объект не найден"} + case errors.Is(err, errMethodNotAllowed): + return apiError{http.StatusMethodNotAllowed, InvalidRequest, "метод не поддерживается"} + case errors.Is(err, model.ErrUsernameTaken): + return apiError{http.StatusConflict, Conflict, "username уже занят"} + case errors.Is(err, model.ErrConflict): + return apiError{http.StatusConflict, Conflict, "конфликт запроса"} + case errors.Is(err, model.ErrUnavailable): + return apiError{http.StatusServiceUnavailable, Unavailable, "зависимость недоступна"} + case errors.Is(err, errPayloadTooLarge): + return apiError{http.StatusRequestEntityTooLarge, PayloadTooLarge, "тело запроса больше допустимого"} + case errors.Is(err, model.ErrStorageFull): + return apiError{http.StatusServiceUnavailable, Unavailable, "хранилище заполнено, запись невозможна; чтение работает"} + case errors.Is(err, errOverloaded): + return apiError{http.StatusServiceUnavailable, Unavailable, "сервер перегружен, повторите позже"} + case errors.Is(err, errDraining): + return apiError{http.StatusServiceUnavailable, Unavailable, "сервер останавливается"} + default: + return apiError{http.StatusInternalServerError, InternalError, "внутренняя ошибка"} + } +} + +func (h *API) writeError(w http.ResponseWriter, r *http.Request, err error) { + e := classify(err) + if e.status == http.StatusInternalServerError { + h.log.Error().Err(err).Str("request_id", requestIDFrom(r.Context())).Msg("unexpected error") + } + if errors.Is(err, errOverloaded) { + w.Header().Set("Retry-After", "1") + } + var body Error + body.Error.Code = e.code + body.Error.Message = e.message + body.Error.RequestId = requestIDFrom(r.Context()) + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(e.status) + _ = json.NewEncoder(w).Encode(body) +} + +// bodyError — JSON синтаксически верен (это проверил jsonBody), но не +// подходит к схеме: лишнее поле или неверный тип. +func (h *API) bodyError(w http.ResponseWriter, r *http.Request, _ error) { + h.writeError(w, r, &model.ValidationError{Message: "тело запроса не соответствует схеме: лишнее поле или неверный тип"}) +} + +// paramError — path или query параметр не разобрался (UUID, целое число). +func (h *API) paramError(w http.ResponseWriter, r *http.Request, _ error) { + h.writeError(w, r, &model.ValidationError{Message: "некорректный параметр запроса"}) +} diff --git a/backend/internal/adapter/handler/gate.go b/backend/internal/adapter/handler/gate.go new file mode 100644 index 00000000..e9675f26 --- /dev/null +++ b/backend/internal/adapter/handler/gate.go @@ -0,0 +1,78 @@ +package handler + +import ( + "net/http" + "sync/atomic" + "time" +) + +// gate ограничивает одновременную обработку запросов API: не больше inflight +// в работе и не больше queue в ожидании слота. Лишние сразу получают 503 с +// Retry-After, ждавшие дольше timeout — тоже 503. Так перегрузка превращается +// в быстрый предсказуемый отказ, а не в рост горутин, памяти и задержки. +type gate struct { + slots chan struct{} // nil — без лимита + maxQueue int64 + timeout time.Duration + waiting atomic.Int64 + rejected atomic.Int64 +} + +func newGate(inflight, queue int, timeout time.Duration) *gate { + g := &gate{maxQueue: int64(queue), timeout: timeout} + if inflight > 0 { + g.slots = make(chan struct{}, inflight) + } + return g +} + +func (g *gate) middleware(reject func(http.ResponseWriter, *http.Request, error)) func(http.Handler) http.Handler { + return func(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if g.slots == nil { + next.ServeHTTP(w, r) + return + } + if !g.acquire(r) { + g.rejected.Add(1) + reject(w, r, errOverloaded) + return + } + defer func() { <-g.slots }() + next.ServeHTTP(w, r) + }) + } +} + +func (g *gate) acquire(r *http.Request) bool { + select { + case g.slots <- struct{}{}: + return true + default: + } + if g.waiting.Add(1) > g.maxQueue { + g.waiting.Add(-1) + return false + } + defer g.waiting.Add(-1) + timer := time.NewTimer(g.timeout) + defer timer.Stop() + select { + case g.slots <- struct{}{}: + return true + case <-timer.C: + return false + case <-r.Context().Done(): + return false + } +} + +type gateStats struct { + Inflight int `json:"inflight"` + Waiting int64 `json:"waiting"` + Rejected int64 `json:"rejected"` +} + +func (g *gate) stats() gateStats { + return gateStats{Inflight: len(g.slots), Waiting: g.waiting.Load(), Rejected: g.rejected.Load()} +} diff --git a/backend/internal/adapter/handler/gate_test.go b/backend/internal/adapter/handler/gate_test.go new file mode 100644 index 00000000..7f988ece --- /dev/null +++ b/backend/internal/adapter/handler/gate_test.go @@ -0,0 +1,102 @@ +package handler + +import ( + "errors" + "net/http" + "net/http/httptest" + "sync" + "testing" + "time" +) + +// gatedServer пропускает запросы через gate в обработчик, который держит слот, +// пока тест не закроет release. +func gatedServer(t *testing.T, g *gate) (*httptest.Server, chan struct{}, chan struct{}) { + t.Helper() + entered, release := make(chan struct{}, 10), make(chan struct{}) + reject := func(w http.ResponseWriter, _ *http.Request, err error) { + if !errors.Is(err, errOverloaded) { + t.Errorf("unexpected error %v", err) + } + w.Header().Set("Retry-After", "1") + w.WriteHeader(http.StatusServiceUnavailable) + } + h := g.middleware(reject)(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + entered <- struct{}{} + <-release + w.WriteHeader(http.StatusOK) + })) + srv := httptest.NewServer(h) + t.Cleanup(srv.Close) + return srv, entered, release +} + +func get(t *testing.T, url string) int { + t.Helper() + resp, err := http.Get(url) + if err != nil { + t.Error(err) + return 0 + } + resp.Body.Close() + return resp.StatusCode +} + +func waitFor(t *testing.T, cond func() bool) { + t.Helper() + deadline := time.Now().Add(2 * time.Second) + for !cond() { + if time.Now().After(deadline) { + t.Fatal("condition not reached") + } + time.Sleep(time.Millisecond) + } +} + +func TestGateRejectsBeyondQueueAndRecovers(t *testing.T) { + t.Parallel() + g := newGate(1, 1, time.Minute) + srv, entered, release := gatedServer(t, g) + + statuses := make(chan int, 2) + var wg sync.WaitGroup + wg.Go(func() { statuses <- get(t, srv.URL) }) // занимает слот + <-entered + wg.Go(func() { statuses <- get(t, srv.URL) }) // ждёт в очереди + waitFor(t, func() bool { return g.waiting.Load() == 1 }) + + if code := get(t, srv.URL); code != http.StatusServiceUnavailable { + t.Fatalf("third request: %d, want 503", code) + } + close(release) + wg.Wait() + close(statuses) + for code := range statuses { + if code != http.StatusOK { + t.Fatalf("admitted request got %d", code) + } + } + if code := get(t, srv.URL); code != http.StatusOK { + t.Fatalf("after load: %d, want recovery to 200", code) + } + if g.stats().Rejected != 1 { + t.Fatalf("rejected %d", g.stats().Rejected) + } +} + +func TestGateTimesOutQueuedRequest(t *testing.T) { + t.Parallel() + g := newGate(1, 10, 20*time.Millisecond) + srv, entered, release := gatedServer(t, g) + defer close(release) + + go get(t, srv.URL) + <-entered + start := time.Now() + if code := get(t, srv.URL); code != http.StatusServiceUnavailable { + t.Fatalf("queued request: %d, want 503 after timeout", code) + } + if time.Since(start) > time.Second { + t.Fatal("queue timeout not applied") + } +} diff --git a/backend/internal/adapter/handler/handler.go b/backend/internal/adapter/handler/handler.go new file mode 100644 index 00000000..29d44aae --- /dev/null +++ b/backend/internal/adapter/handler/handler.go @@ -0,0 +1,95 @@ +package handler + +import ( + "context" + "net/http" + "sync/atomic" + "time" + + "backend/internal/application/usecase" + + "github.com/go-chi/chi/v5" + "github.com/rs/zerolog" +) + +// Limits — защитные лимиты HTTP-слоя (трек 5 «управляемая деградация»). +// Нулевое значение отключает лимит. +type Limits struct { + MaxBodyBytes int64 // больше — 413 + MaxInflight int // одновременно обрабатываемые запросы API + MaxQueue int // ждущие свободного слота; больше — сразу 503 + QueueTimeout time.Duration // дольше ждал слот — 503 +} + +// API — driving HTTP-адаптер: реализует StrictServerInterface из api.gen.go. +// +//go:generate go tool oapi-codegen -config ../../../codegen.yaml ../../../../contracts/openapi.json +type API struct { + app *usecase.Messenger + auth *usecase.Auth + probe func(context.Context) error + limits Limits + gate *gate + storeStats func() any + ready atomic.Bool + log *zerolog.Logger +} + +// New собирает HTTP-адаптер. storeStats отдаёт состояние хранилища для +// /debug/stats. +func New(app *usecase.Messenger, auth *usecase.Auth, probe func(context.Context) error, limits Limits, storeStats func() any, log *zerolog.Logger) *API { + h := &API{ + app: app, + auth: auth, + probe: probe, + limits: limits, + gate: newGate(limits.MaxInflight, limits.MaxQueue, limits.QueueTimeout), + storeStats: storeStats, + log: log, + } + h.ready.Store(true) + return h +} + +// Drain переводит /health/ready в 503 перед остановкой сервера. +func (h *API) Drain() { h.ready.Store(false) } + +func (h *API) Router() http.Handler { + r := chi.NewRouter() + r.Use(requestID, h.recoverer, h.accessLog, h.requestContext) + r.NotFound(func(w http.ResponseWriter, r *http.Request) { + h.writeError(w, r, errRouteNotFound) + }) + r.MethodNotAllowed(func(w http.ResponseWriter, r *http.Request) { + h.writeError(w, r, errMethodNotAllowed) + }) + + strict := NewStrictHandlerWithOptions(h, nil, StrictHTTPServerOptions{ + RequestErrorHandlerFunc: h.bodyError, + ResponseErrorHandlerFunc: h.writeError, + }) + api := ServerInterfaceWrapper{Handler: strict, ErrorHandlerFunc: h.paramError} + + // Health и статистика — мимо очереди: под перегрузкой они должны отвечать. + r.Get("/health/live", api.Liveness) + r.Get("/health/ready", api.Readiness) + r.Get("/debug/stats", h.stats) + + r.Route("/api/v1", func(r chi.Router) { + r.Use(h.gate.middleware(h.writeError)) + r.With(h.jsonBody).Post("/users", api.RegisterUser) + r.Post("/auth/sessions", api.CreateSession) + // Сначала аутентификация, потом тело и доступ к ресурсу. + r.Group(func(r chi.Router) { + r.Use(h.authenticate, h.validQuery, h.jsonBody) + r.Delete("/auth/sessions/current", api.RevokeSession) + r.Get("/users/me", api.CurrentUser) + r.Post("/chats", api.CreateChat) + r.Get("/chats", api.ListChats) + r.Get("/chats/{chat_id}", api.GetChat) + r.Post("/chats/{chat_id}/messages", api.CreateMessage) + r.Get("/chats/{chat_id}/messages", api.ListMessages) + }) + }) + return r +} diff --git a/backend/internal/adapter/handler/json.go b/backend/internal/adapter/handler/json.go new file mode 100644 index 00000000..f4d52812 --- /dev/null +++ b/backend/internal/adapter/handler/json.go @@ -0,0 +1,53 @@ +package handler + +import ( + "bytes" + "encoding/json" + "time" +) + +// Timestamp подставляется кодогенератором вместо time.Time (codegen.yaml, +// type-mapping): RFC 3339 UTC с ровно шестью цифрами дробной части. +// time.Time срезает хвостовые нули, а fromisoformat в Python 3.9–3.10 +// (на нём публичные тесты) понимает дробную часть только из 3 или 6 цифр. +type Timestamp time.Time + +const timestampLayout = "2006-01-02T15:04:05.000000Z" + +func (t Timestamp) MarshalJSON() ([]byte, error) { + return []byte(`"` + time.Time(t).UTC().Format(timestampLayout) + `"`), nil +} + +func (t *Timestamp) UnmarshalJSON(data []byte) error { + var parsed time.Time + if err := json.Unmarshal(data, &parsed); err != nil { + return err + } + *t = Timestamp(parsed) + return nil +} + +// Тела запросов с лишними полями — 400 по контракту, а сгенерированный +// декодер их молча игнорирует. Строгий разбор подключается методами на +// сгенерированных типах. + +func (c *CreateUser) UnmarshalJSON(data []byte) error { + type plain CreateUser + return decodeStrict(data, (*plain)(c)) +} + +func (c *CreateChat) UnmarshalJSON(data []byte) error { + type plain CreateChat + return decodeStrict(data, (*plain)(c)) +} + +func (c *CreateMessage) UnmarshalJSON(data []byte) error { + type plain CreateMessage + return decodeStrict(data, (*plain)(c)) +} + +func decodeStrict(data []byte, dst any) error { + dec := json.NewDecoder(bytes.NewReader(data)) + dec.DisallowUnknownFields() + return dec.Decode(dst) +} diff --git a/backend/internal/adapter/handler/middleware.go b/backend/internal/adapter/handler/middleware.go new file mode 100644 index 00000000..750cbd09 --- /dev/null +++ b/backend/internal/adapter/handler/middleware.go @@ -0,0 +1,161 @@ +package handler + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "io" + "net/http" + "net/url" + "os" + "runtime/debug" + "strings" + "time" + "unicode/utf8" + + "backend/internal/domain/model" + + "github.com/go-chi/chi/v5" + "github.com/go-chi/chi/v5/middleware" + "github.com/google/uuid" +) + +type ctxKey int + +const ( + requestIDKey ctxKey = iota + userKey +) + +// requestID ставит X-Request-Id в каждый ответ, включая ошибки и health. +func requestID(next http.Handler) http.Handler { + instance, _ := os.Hostname() + if instance == "" { + instance = uuid.NewString() + } + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + id := uuid.NewString() + w.Header().Set("X-Request-Id", id) + w.Header().Set("X-Instance-Id", instance) + next.ServeHTTP(w, r.WithContext(context.WithValue(r.Context(), requestIDKey, id))) + }) +} + +func requestIDFrom(ctx context.Context) string { + id, _ := ctx.Value(requestIDKey).(string) + return id +} + +// recoverer превращает панику в 500 без деталей; стек — только в лог. +func (h *API) recoverer(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + defer func() { + rec := recover() + if rec == nil { + return + } + if rec == http.ErrAbortHandler { + panic(rec) + } + h.log.Error().Interface("panic", rec).Bytes("stack", debug.Stack()). + Str("request_id", requestIDFrom(r.Context())).Msg("panic") + h.writeError(w, r, errors.New("panic")) + }() + next.ServeHTTP(w, r) + }) +} + +// accessLog пишет метод, шаблон маршрута, статус и длительность. Тело, query +// и заголовки не логируются: там текст сообщений и идентификаторы. +func (h *API) accessLog(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + start := time.Now() + ww := middleware.NewWrapResponseWriter(w, r.ProtoMajor) + next.ServeHTTP(ww, r) + route := chi.RouteContext(r.Context()).RoutePattern() + if route == "" { + route = "unmatched" + } + event := h.log.Info() + if ww.Status() >= http.StatusInternalServerError { + event = h.log.Warn() + } + event.Str("request_id", requestIDFrom(r.Context())). + Str("method", r.Method). + Str("route", route). + Int("status", ww.Status()). + Dur("duration", time.Since(start)). + Msg("request") + }) +} + +// authenticate verifies persisted Bearer sessions for protected business routes. +// The session-creation endpoint separately validates Basic credentials. +func (h *API) authenticate(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + parts := strings.Fields(r.Header.Get("Authorization")) + if len(parts) != 2 || !strings.EqualFold(parts[0], "Bearer") { + w.Header().Set("WWW-Authenticate", `Bearer realm="messenger"`) + h.writeError(w, r, model.ErrUnauthorized) + return + } + user, err := h.auth.Authenticate(r.Context(), parts[1]) + if err != nil { + if errors.Is(err, model.ErrUnauthorized) { + w.Header().Set("WWW-Authenticate", `Bearer realm="messenger"`) + } + h.writeError(w, r, err) + return + } + next.ServeHTTP(w, r.WithContext(context.WithValue(r.Context(), userKey, user))) + }) +} + +// validQuery отсекает query с битым %-экранированием: url.Values молча +// выбросил бы такой параметр, и cursor=%%% превратился бы в «с начала». +func (h *API) validQuery(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if _, err := url.ParseQuery(r.URL.RawQuery); err != nil { + h.writeError(w, r, &model.ValidationError{Message: "некорректная строка запроса"}) + return + } + next.ServeHTTP(w, r) + }) +} + +func currentUser(ctx context.Context) model.User { + user, _ := ctx.Value(userKey).(model.User) + return user +} + +// jsonBody читает тело POST с лимитом размера (иначе 413) и отсекает +// синтаксически неверный JSON (400) до кодогенерированного декодера: тот +// читает только первое JSON-значение и пропустил бы мусор после него. +func (h *API) jsonBody(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + next.ServeHTTP(w, r) + return + } + reader := io.Reader(r.Body) + if h.limits.MaxBodyBytes > 0 { + reader = http.MaxBytesReader(w, r.Body, h.limits.MaxBodyBytes) + } + body, err := io.ReadAll(reader) + var tooLarge *http.MaxBytesError + switch { + case errors.As(err, &tooLarge): + h.writeError(w, r, errPayloadTooLarge) + return + case err != nil: + h.writeError(w, r, &model.ValidationError{Message: "тело запроса не прочитано"}) + return + case !utf8.Valid(body) || !json.Valid(body): + h.writeError(w, r, &model.ValidationError{Message: "некорректный JSON"}) + return + } + r.Body = io.NopCloser(bytes.NewReader(body)) + next.ServeHTTP(w, r) + }) +} diff --git a/backend/internal/adapter/handler/stats.go b/backend/internal/adapter/handler/stats.go new file mode 100644 index 00000000..244dfbf2 --- /dev/null +++ b/backend/internal/adapter/handler/stats.go @@ -0,0 +1,47 @@ +package handler + +import ( + "bufio" + "encoding/json" + "net/http" + "os" + "runtime" + "runtime/debug" + "strconv" + "strings" +) + +// stats — расширение за пределами контракта (contracts/extensions.md): память +// процесса, учтённый объём хранилища и очередь. Нужен для графиков трека 5. +func (h *API) stats(w http.ResponseWriter, _ *http.Request) { + var mem runtime.MemStats + runtime.ReadMemStats(&mem) + w.Header().Set("Content-Type", "application/json") + _ = json.NewEncoder(w).Encode(map[string]any{ + "rss_bytes": rssBytes(), + "heap_alloc": mem.HeapAlloc, + "heap_sys": mem.HeapSys, + "go_memory_limit": debug.SetMemoryLimit(-1), + "num_gc": mem.NumGC, + "goroutines": runtime.NumGoroutine(), + "gate": h.gate.stats(), + "store": h.storeStats(), + }) +} + +// rssBytes читает VmRSS из /proc (только Linux, то есть в контейнере); иначе 0. +func rssBytes() int64 { + f, err := os.Open("/proc/self/status") + if err != nil { + return 0 + } + defer f.Close() + sc := bufio.NewScanner(f) + for sc.Scan() { + if kb, ok := strings.CutPrefix(sc.Text(), "VmRSS:"); ok { + n, _ := strconv.ParseInt(strings.TrimSpace(strings.TrimSuffix(kb, "kB")), 10, 64) + return n * 1024 + } + } + return 0 +} diff --git a/backend/internal/adapter/handler/utf8_test.go b/backend/internal/adapter/handler/utf8_test.go new file mode 100644 index 00000000..70d33f9c --- /dev/null +++ b/backend/internal/adapter/handler/utf8_test.go @@ -0,0 +1,21 @@ +package handler + +import ( + "bytes" + "net/http" + "net/http/httptest" + "testing" +) + +func TestRejectsInvalidUTF8BeforeJSONDecoding(t *testing.T) { + body := append([]byte(`{"display_name":"`), 0xff) + body = append(body, []byte(`"}`)...) + request := httptest.NewRequest(http.MethodPost, "/api/v1/users", bytes.NewReader(body)) + response := httptest.NewRecorder() + h := &API{limits: Limits{MaxBodyBytes: 65536}} + called := false + requestID(h.jsonBody(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { called = true; w.WriteHeader(204) }))).ServeHTTP(response, request) + if response.Code != 400 || called { + t.Fatalf("invalid UTF-8 reached decoder: status=%d called=%t", response.Code, called) + } +} diff --git a/backend/internal/adapter/password/argon.go b/backend/internal/adapter/password/argon.go new file mode 100644 index 00000000..a58ca6f0 --- /dev/null +++ b/backend/internal/adapter/password/argon.go @@ -0,0 +1,36 @@ +package password + +import ( + "backend/internal/domain/port" + "crypto/rand" + "crypto/subtle" + "encoding/base64" + "fmt" + "golang.org/x/crypto/argon2" + "strings" +) + +type Argon struct{} + +func New() port.Passwords { return Argon{} } +func (Argon) Hash(password string) (string, error) { + salt := make([]byte, 16) + if _, err := rand.Read(salt); err != nil { + return "", err + } + hash := argon2.IDKey([]byte(password), salt, 2, 32*1024, 1, 32) + return fmt.Sprintf("argon2id$v19$m32768t2p1$%s$%s", base64.RawStdEncoding.EncodeToString(salt), base64.RawStdEncoding.EncodeToString(hash)), nil +} +func (Argon) Verify(password, encoded string) bool { + parts := strings.Split(encoded, "$") + if len(parts) != 5 || parts[0] != "argon2id" || parts[1] != "v19" || parts[2] != "m32768t2p1" { + return false + } + salt, e1 := base64.RawStdEncoding.DecodeString(parts[3]) + want, e2 := base64.RawStdEncoding.DecodeString(parts[4]) + if e1 != nil || e2 != nil || len(salt) != 16 || len(want) != 32 { + return false + } + got := argon2.IDKey([]byte(password), salt, 2, 32*1024, 1, 32) + return subtle.ConstantTimeCompare(got, want) == 1 +} diff --git a/backend/internal/adapter/repository/postgres/queries/core.sql.go b/backend/internal/adapter/repository/postgres/queries/core.sql.go new file mode 100644 index 00000000..c93e41f7 --- /dev/null +++ b/backend/internal/adapter/repository/postgres/queries/core.sql.go @@ -0,0 +1,347 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: core.sql + +package queries + +import ( + "context" + "time" + + "github.com/google/uuid" +) + +const authenticateSession = `-- name: AuthenticateSession :one +SELECT user_id FROM sessions WHERE token_hash=$1 AND expires_at>clock_timestamp() +` + +func (q *Queries) AuthenticateSession(ctx context.Context, tokenHash string) (uuid.UUID, error) { + row := q.db.QueryRow(ctx, authenticateSession, tokenHash) + var user_id uuid.UUID + err := row.Scan(&user_id) + return user_id, err +} + +const chargeChat = `-- name: ChargeChat :one +UPDATE users SET chat_count=chat_count+1 WHERE id=$1 AND chat_count<1000 RETURNING id +` + +func (q *Queries) ChargeChat(ctx context.Context, id uuid.UUID) (uuid.UUID, error) { + row := q.db.QueryRow(ctx, chargeChat, id) + var id_2 uuid.UUID + err := row.Scan(&id_2) + return id_2, err +} + +const chargeMessage = `-- name: ChargeMessage :one +UPDATE users SET message_count=message_count+1 WHERE id=$1 AND message_count<1000000 RETURNING id +` + +func (q *Queries) ChargeMessage(ctx context.Context, id uuid.UUID) (uuid.UUID, error) { + row := q.db.QueryRow(ctx, chargeMessage, id) + var id_2 uuid.UUID + err := row.Scan(&id_2) + return id_2, err +} + +const createUser = `-- name: CreateUser :one +INSERT INTO users(id,username,display_name,password_hash) VALUES($1,$2,$3,$4) +RETURNING id,username,display_name,created_at +` + +type CreateUserParams struct { + ID uuid.UUID + Username string + DisplayName string + PasswordHash string +} + +type CreateUserRow struct { + ID uuid.UUID + Username string + DisplayName string + CreatedAt time.Time +} + +func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (CreateUserRow, error) { + row := q.db.QueryRow(ctx, createUser, + arg.ID, + arg.Username, + arg.DisplayName, + arg.PasswordHash, + ) + var i CreateUserRow + err := row.Scan( + &i.ID, + &i.Username, + &i.DisplayName, + &i.CreatedAt, + ) + return i, err +} + +const credentials = `-- name: Credentials :one +SELECT id,password_hash FROM users WHERE username=$1 +` + +type CredentialsRow struct { + ID uuid.UUID + PasswordHash string +} + +func (q *Queries) Credentials(ctx context.Context, username string) (CredentialsRow, error) { + row := q.db.QueryRow(ctx, credentials, username) + var i CredentialsRow + err := row.Scan(&i.ID, &i.PasswordHash) + return i, err +} + +const deleteExpiredSessions = `-- name: DeleteExpiredSessions :exec +DELETE FROM sessions WHERE user_id=$1 AND expires_at<=clock_timestamp() +` + +func (q *Queries) DeleteExpiredSessions(ctx context.Context, userID uuid.UUID) error { + _, err := q.db.Exec(ctx, deleteExpiredSessions, userID) + return err +} + +const getChat = `-- name: GetChat :one +SELECT c.id,c.title,c.created_at,ARRAY(SELECT user_id FROM chat_members WHERE chat_id=c.id ORDER BY user_id)::uuid[] AS members +FROM chats c WHERE c.id=$1 +` + +type GetChatRow struct { + ID uuid.UUID + Title string + CreatedAt time.Time + Members []uuid.UUID +} + +func (q *Queries) GetChat(ctx context.Context, id uuid.UUID) (GetChatRow, error) { + row := q.db.QueryRow(ctx, getChat, id) + var i GetChatRow + err := row.Scan( + &i.ID, + &i.Title, + &i.CreatedAt, + &i.Members, + ) + return i, err +} + +const getUser = `-- name: GetUser :one +SELECT id,username,display_name,created_at FROM users WHERE id=$1 +` + +type GetUserRow struct { + ID uuid.UUID + Username string + DisplayName string + CreatedAt time.Time +} + +func (q *Queries) GetUser(ctx context.Context, id uuid.UUID) (GetUserRow, error) { + row := q.db.QueryRow(ctx, getUser, id) + var i GetUserRow + err := row.Scan( + &i.ID, + &i.Username, + &i.DisplayName, + &i.CreatedAt, + ) + return i, err +} + +const insertChat = `-- name: InsertChat :one +INSERT INTO chats(id,title) VALUES($1,$2) RETURNING id,title,created_at +` + +type InsertChatParams struct { + ID uuid.UUID + Title string +} + +func (q *Queries) InsertChat(ctx context.Context, arg InsertChatParams) (Chat, error) { + row := q.db.QueryRow(ctx, insertChat, arg.ID, arg.Title) + var i Chat + err := row.Scan(&i.ID, &i.Title, &i.CreatedAt) + return i, err +} + +const insertMembers = `-- name: InsertMembers :exec +INSERT INTO chat_members(chat_id,user_id) SELECT $1,unnest($2::uuid[]) +` + +type InsertMembersParams struct { + ChatID uuid.UUID + Column2 []uuid.UUID +} + +func (q *Queries) InsertMembers(ctx context.Context, arg InsertMembersParams) error { + _, err := q.db.Exec(ctx, insertMembers, arg.ChatID, arg.Column2) + return err +} + +const insertMessage = `-- name: InsertMessage :one +INSERT INTO messages(id,chat_id,sender_id,text) VALUES($1,$2,$3,$4) RETURNING id,chat_id,sender_id,text,created_at +` + +type InsertMessageParams struct { + ID uuid.UUID + ChatID uuid.UUID + SenderID uuid.UUID + Text string +} + +func (q *Queries) InsertMessage(ctx context.Context, arg InsertMessageParams) (Message, error) { + row := q.db.QueryRow(ctx, insertMessage, + arg.ID, + arg.ChatID, + arg.SenderID, + arg.Text, + ) + var i Message + err := row.Scan( + &i.ID, + &i.ChatID, + &i.SenderID, + &i.Text, + &i.CreatedAt, + ) + return i, err +} + +const insertSession = `-- name: InsertSession :one +INSERT INTO sessions(token_hash,user_id,expires_at) +SELECT $1,$2,$3 WHERE (SELECT count(*) FROM sessions WHERE user_id=$2)<100 +RETURNING user_id +` + +type InsertSessionParams struct { + TokenHash string + UserID uuid.UUID + ExpiresAt time.Time +} + +func (q *Queries) InsertSession(ctx context.Context, arg InsertSessionParams) (uuid.UUID, error) { + row := q.db.QueryRow(ctx, insertSession, arg.TokenHash, arg.UserID, arg.ExpiresAt) + var user_id uuid.UUID + err := row.Scan(&user_id) + return user_id, err +} + +const listChats = `-- name: ListChats :many +SELECT c.id,c.title,c.created_at,ARRAY(SELECT user_id FROM chat_members WHERE chat_id=c.id ORDER BY user_id)::uuid[] AS members +FROM chats c JOIN chat_members m ON m.chat_id=c.id +WHERE m.user_id=$1 AND (c.created_at,c.id)>($2::timestamptz,$3::uuid) +ORDER BY c.created_at,c.id LIMIT $4 +` + +type ListChatsParams struct { + MemberID uuid.UUID + AfterTime time.Time + AfterID uuid.UUID + PageLimit int32 +} + +type ListChatsRow struct { + ID uuid.UUID + Title string + CreatedAt time.Time + Members []uuid.UUID +} + +func (q *Queries) ListChats(ctx context.Context, arg ListChatsParams) ([]ListChatsRow, error) { + rows, err := q.db.Query(ctx, listChats, + arg.MemberID, + arg.AfterTime, + arg.AfterID, + arg.PageLimit, + ) + if err != nil { + return nil, err + } + defer rows.Close() + items := []ListChatsRow{} + for rows.Next() { + var i ListChatsRow + if err := rows.Scan( + &i.ID, + &i.Title, + &i.CreatedAt, + &i.Members, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listMessages = `-- name: ListMessages :many +SELECT id,chat_id,sender_id,text,created_at FROM messages +WHERE chat_id=$1 AND (created_at,id)>($2::timestamptz,$3::uuid) +ORDER BY created_at,id LIMIT $4 +` + +type ListMessagesParams struct { + ChatID uuid.UUID + AfterTime time.Time + AfterID uuid.UUID + PageLimit int32 +} + +func (q *Queries) ListMessages(ctx context.Context, arg ListMessagesParams) ([]Message, error) { + rows, err := q.db.Query(ctx, listMessages, + arg.ChatID, + arg.AfterTime, + arg.AfterID, + arg.PageLimit, + ) + if err != nil { + return nil, err + } + defer rows.Close() + items := []Message{} + for rows.Next() { + var i Message + if err := rows.Scan( + &i.ID, + &i.ChatID, + &i.SenderID, + &i.Text, + &i.CreatedAt, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const lockSessionOwner = `-- name: LockSessionOwner :one +SELECT id FROM users WHERE id=$1 FOR UPDATE +` + +func (q *Queries) LockSessionOwner(ctx context.Context, id uuid.UUID) (uuid.UUID, error) { + row := q.db.QueryRow(ctx, lockSessionOwner, id) + var id_2 uuid.UUID + err := row.Scan(&id_2) + return id_2, err +} + +const revokeSession = `-- name: RevokeSession :exec +DELETE FROM sessions WHERE token_hash=$1 +` + +func (q *Queries) RevokeSession(ctx context.Context, tokenHash string) error { + _, err := q.db.Exec(ctx, revokeSession, tokenHash) + return err +} diff --git a/backend/internal/adapter/repository/postgres/queries/db.go b/backend/internal/adapter/repository/postgres/queries/db.go new file mode 100644 index 00000000..c69f0c53 --- /dev/null +++ b/backend/internal/adapter/repository/postgres/queries/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package queries + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/backend/internal/adapter/repository/postgres/queries/idempotency.sql.go b/backend/internal/adapter/repository/postgres/queries/idempotency.sql.go new file mode 100644 index 00000000..bb33c459 --- /dev/null +++ b/backend/internal/adapter/repository/postgres/queries/idempotency.sql.go @@ -0,0 +1,78 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: idempotency.sql + +package queries + +import ( + "context" + "time" + + "github.com/google/uuid" +) + +const replayMessage = `-- name: ReplayMessage :one +SELECT m.id,m.chat_id,m.sender_id,m.text,m.created_at,i.payload_hash +FROM idempotency i JOIN messages m ON m.id=i.message_id +WHERE i.user_id=$1 AND i.chat_id=$2 AND i.key=$3 +` + +type ReplayMessageParams struct { + UserID uuid.UUID + ChatID uuid.UUID + Key string +} + +type ReplayMessageRow struct { + ID uuid.UUID + ChatID uuid.UUID + SenderID uuid.UUID + Text string + CreatedAt time.Time + PayloadHash string +} + +func (q *Queries) ReplayMessage(ctx context.Context, arg ReplayMessageParams) (ReplayMessageRow, error) { + row := q.db.QueryRow(ctx, replayMessage, arg.UserID, arg.ChatID, arg.Key) + var i ReplayMessageRow + err := row.Scan( + &i.ID, + &i.ChatID, + &i.SenderID, + &i.Text, + &i.CreatedAt, + &i.PayloadHash, + ) + return i, err +} + +const reserveKey = `-- name: ReserveKey :one +INSERT INTO idempotency(user_id,chat_id,key,payload_hash,message_id,expires_at) +VALUES($1,$2,$3,$4,$5,clock_timestamp()+interval '24 hours') +ON CONFLICT(user_id,chat_id,key) DO UPDATE SET payload_hash=excluded.payload_hash, +message_id=excluded.message_id,expires_at=excluded.expires_at +WHERE idempotency.expires_at<=clock_timestamp() +RETURNING message_id +` + +type ReserveKeyParams struct { + UserID uuid.UUID + ChatID uuid.UUID + Key string + PayloadHash string + MessageID uuid.UUID +} + +func (q *Queries) ReserveKey(ctx context.Context, arg ReserveKeyParams) (uuid.UUID, error) { + row := q.db.QueryRow(ctx, reserveKey, + arg.UserID, + arg.ChatID, + arg.Key, + arg.PayloadHash, + arg.MessageID, + ) + var message_id uuid.UUID + err := row.Scan(&message_id) + return message_id, err +} diff --git a/backend/internal/adapter/repository/postgres/queries/models.go b/backend/internal/adapter/repository/postgres/queries/models.go new file mode 100644 index 00000000..d73b16a3 --- /dev/null +++ b/backend/internal/adapter/repository/postgres/queries/models.go @@ -0,0 +1,55 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package queries + +import ( + "time" + + "github.com/google/uuid" +) + +type Chat struct { + ID uuid.UUID + Title string + CreatedAt time.Time +} + +type ChatMember struct { + ChatID uuid.UUID + UserID uuid.UUID +} + +type Idempotency struct { + UserID uuid.UUID + ChatID uuid.UUID + Key string + PayloadHash string + MessageID uuid.UUID + ExpiresAt time.Time +} + +type Message struct { + ID uuid.UUID + ChatID uuid.UUID + SenderID uuid.UUID + Text string + CreatedAt time.Time +} + +type Session struct { + TokenHash string + UserID uuid.UUID + ExpiresAt time.Time +} + +type User struct { + ID uuid.UUID + Username string + DisplayName string + PasswordHash string + CreatedAt time.Time + ChatCount int32 + MessageCount int32 +} diff --git a/backend/internal/adapter/repository/postgres/repository.go b/backend/internal/adapter/repository/postgres/repository.go new file mode 100644 index 00000000..67db8d8b --- /dev/null +++ b/backend/internal/adapter/repository/postgres/repository.go @@ -0,0 +1,223 @@ +package postgres + +import ( + "context" + "encoding/json" + "errors" + "time" + + "backend/internal/adapter/repository/postgres/queries" + "backend/internal/domain/model" + "backend/internal/domain/repository" + "github.com/google/uuid" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" + "github.com/jackc/pgx/v5/pgxpool" + "github.com/redis/go-redis/v9" +) + +//go:generate go tool sqlc generate -f ../../../../db/sqlc/sqlc.yaml +type Store struct { + pool *pgxpool.Pool + q *queries.Queries + cache *redis.Client +} + +func New(pool *pgxpool.Pool, cache *redis.Client) repository.Persistent { + return &Store{pool, queries.New(pool), cache} +} +func mapErr(err error) error { + if err == nil { + return nil + } + if errors.Is(err, pgx.ErrNoRows) { + return model.ErrNotFound + } + var pg *pgconn.PgError + if errors.As(err, &pg) { + switch pg.Code { + case "23505": + return model.ErrUsernameTaken + case "23503": + return model.ErrUnknownMember + case "23514": + return &model.ValidationError{Message: "constraint violation"} + } + } + return model.ErrUnavailable +} +func (s *Store) CreateUser(ctx context.Context, d model.UserDraft) (model.User, error) { + row, err := s.q.CreateUser(ctx, queries.CreateUserParams{ID: uuid.New(), Username: d.Username, DisplayName: d.DisplayName, PasswordHash: d.PasswordHash}) + return model.User{ID: row.ID, Username: row.Username, DisplayName: row.DisplayName, CreatedAt: row.CreatedAt}, mapErr(err) +} +func (s *Store) GetUser(ctx context.Context, id uuid.UUID) (model.User, error) { + key := "profile:" + id.String() + if s.cache != nil { + c, cancel := context.WithTimeout(ctx, 80*time.Millisecond) + raw, err := s.cache.Get(c, key).Bytes() + cancel() + if err == nil { + var u model.User + if json.Unmarshal(raw, &u) == nil && u.ID == id { + return u, nil + } + } + } + row, err := s.q.GetUser(ctx, id) + if err != nil { + return model.User{}, mapErr(err) + } + user := model.User{ID: row.ID, Username: row.Username, DisplayName: row.DisplayName, CreatedAt: row.CreatedAt} + if s.cache != nil { + raw, e := json.Marshal(user) + if e == nil { + c, cancel := context.WithTimeout(ctx, 80*time.Millisecond) + _ = s.cache.Set(c, key, raw, time.Minute).Err() + cancel() + } + } + return user, nil +} +func (s *Store) CreateChat(ctx context.Context, d model.ChatDraft) (model.Chat, error) { + tx, err := s.pool.Begin(ctx) + if err != nil { + return model.Chat{}, mapErr(err) + } + defer func() { _ = tx.Rollback(ctx) }() + q := s.q.WithTx(tx) + if _, err = q.ChargeChat(ctx, d.Creator); err != nil { + if errors.Is(err, pgx.ErrNoRows) { + return model.Chat{}, model.ErrStorageFull + } + return model.Chat{}, mapErr(err) + } + row, err := q.InsertChat(ctx, queries.InsertChatParams{ID: uuid.New(), Title: d.Title}) + if err != nil { + return model.Chat{}, mapErr(err) + } + if err = q.InsertMembers(ctx, queries.InsertMembersParams{ChatID: row.ID, Column2: d.MemberIDs}); err != nil { + return model.Chat{}, mapErr(err) + } + if err = tx.Commit(ctx); err != nil { + return model.Chat{}, mapErr(err) + } + return model.Chat{ID: row.ID, Title: row.Title, CreatedAt: row.CreatedAt, MemberIDs: d.MemberIDs}, nil +} +func (s *Store) GetChat(ctx context.Context, id uuid.UUID) (model.Chat, error) { + r, e := s.q.GetChat(ctx, id) + return model.Chat{ID: r.ID, Title: r.Title, CreatedAt: r.CreatedAt, MemberIDs: r.Members}, mapErr(e) +} +func position(q model.PageQuery) (time.Time, uuid.UUID) { + if q.After == nil { + return time.Unix(0, 0).UTC(), uuid.Nil + } + return q.After.CreatedAt, q.After.ID +} +func (s *Store) ListChats(ctx context.Context, id uuid.UUID, p model.PageQuery) ([]model.Chat, bool, error) { + at, aid := position(p) + rows, err := s.q.ListChats(ctx, queries.ListChatsParams{MemberID: id, AfterTime: at, AfterID: aid, PageLimit: int32(p.Limit + 1)}) + if err != nil { + return nil, false, mapErr(err) + } + more := len(rows) > p.Limit + if more { + rows = rows[:p.Limit] + } + out := make([]model.Chat, len(rows)) + for i, r := range rows { + out[i] = model.Chat{ID: r.ID, Title: r.Title, CreatedAt: r.CreatedAt, MemberIDs: r.Members} + } + return out, more, nil +} +func (s *Store) CreateMessage(ctx context.Context, d model.MessageDraft) (model.Message, error) { + tx, err := s.pool.Begin(ctx) + if err != nil { + return model.Message{}, mapErr(err) + } + defer func() { _ = tx.Rollback(ctx) }() + q := s.q.WithTx(tx) + messageID := uuid.New() + reserved, e := q.ReserveKey(ctx, queries.ReserveKeyParams{UserID: d.SenderID, ChatID: d.ChatID, Key: d.Key, PayloadHash: d.PayloadHash, MessageID: messageID}) + if errors.Is(e, pgx.ErrNoRows) { + r, e := q.ReplayMessage(ctx, queries.ReplayMessageParams{UserID: d.SenderID, ChatID: d.ChatID, Key: d.Key}) + if e != nil { + return model.Message{}, mapErr(e) + } + if r.PayloadHash != d.PayloadHash { + return model.Message{}, model.ErrConflict + } + return model.Message{ID: r.ID, ChatID: r.ChatID, SenderID: r.SenderID, Text: r.Text, CreatedAt: r.CreatedAt}, nil + } + if e != nil { + return model.Message{}, mapErr(e) + } + messageID = reserved + if _, err = q.ChargeMessage(ctx, d.SenderID); err != nil { + if errors.Is(err, pgx.ErrNoRows) { + return model.Message{}, model.ErrStorageFull + } + return model.Message{}, mapErr(err) + } + r, err := q.InsertMessage(ctx, queries.InsertMessageParams{ID: messageID, ChatID: d.ChatID, SenderID: d.SenderID, Text: d.Text}) + if err != nil { + return model.Message{}, mapErr(err) + } + if err = tx.Commit(ctx); err != nil { + return model.Message{}, mapErr(err) + } + return model.Message{ID: r.ID, ChatID: r.ChatID, SenderID: r.SenderID, Text: r.Text, CreatedAt: r.CreatedAt}, nil +} +func (s *Store) ListMessages(ctx context.Context, id uuid.UUID, p model.PageQuery) ([]model.Message, bool, error) { + at, aid := position(p) + rows, err := s.q.ListMessages(ctx, queries.ListMessagesParams{ChatID: id, AfterTime: at, AfterID: aid, PageLimit: int32(p.Limit + 1)}) + if err != nil { + return nil, false, mapErr(err) + } + more := len(rows) > p.Limit + if more { + rows = rows[:p.Limit] + } + out := make([]model.Message, len(rows)) + for i, r := range rows { + out[i] = model.Message{ID: r.ID, ChatID: r.ChatID, SenderID: r.SenderID, Text: r.Text, CreatedAt: r.CreatedAt} + } + return out, more, nil +} +func (s *Store) Credentials(ctx context.Context, name string) (uuid.UUID, string, error) { + r, e := s.q.Credentials(ctx, name) + if errors.Is(e, pgx.ErrNoRows) { + return uuid.Nil, "", model.ErrUnauthorized + } + return r.ID, r.PasswordHash, mapErr(e) +} +func (s *Store) CreateSession(ctx context.Context, hash string, id uuid.UUID, expiry time.Time) error { + tx, e := s.pool.Begin(ctx) + if e != nil { + return mapErr(e) + } + defer func() { _ = tx.Rollback(ctx) }() + q := s.q.WithTx(tx) + if _, e = q.LockSessionOwner(ctx, id); e != nil { + return mapErr(e) + } + if e = q.DeleteExpiredSessions(ctx, id); e != nil { + return mapErr(e) + } + if _, e = q.InsertSession(ctx, queries.InsertSessionParams{TokenHash: hash, UserID: id, ExpiresAt: expiry}); e != nil { + if errors.Is(e, pgx.ErrNoRows) { + return model.ErrStorageFull + } + return mapErr(e) + } + return mapErr(tx.Commit(ctx)) +} +func (s *Store) AuthenticateSession(ctx context.Context, hash string) (uuid.UUID, error) { + r, e := s.q.AuthenticateSession(ctx, hash) + if errors.Is(e, pgx.ErrNoRows) { + return uuid.Nil, model.ErrUnauthorized + } + return r, mapErr(e) +} +func (s *Store) RevokeSession(ctx context.Context, hash string) error { + return mapErr(s.q.RevokeSession(ctx, hash)) +} diff --git a/backend/internal/application/usecase/auth.go b/backend/internal/application/usecase/auth.go new file mode 100644 index 00000000..ea133922 --- /dev/null +++ b/backend/internal/application/usecase/auth.go @@ -0,0 +1,86 @@ +package usecase + +import ( + "context" + "crypto/rand" + "crypto/sha256" + "encoding/base64" + "encoding/hex" + "time" + "unicode/utf8" + + "backend/internal/domain/model" + "backend/internal/domain/port" +) + +type Auth struct { + sessions port.Sessions + passwords port.Passwords + messenger *Messenger + ttl time.Duration + now func() time.Time +} +type Session struct { + Token string + ExpiresAt time.Time + User model.User +} + +func NewAuth(s port.Sessions, p port.Passwords, m *Messenger, ttl time.Duration, now func() time.Time) *Auth { + return &Auth{s, p, m, ttl, now} +} +func (a *Auth) Register(ctx context.Context, username, name, password string) (model.User, error) { + if n := utf8.RuneCountInString(password); n < 12 || n > 128 || !utf8.ValidString(password) { + return model.User{}, &model.ValidationError{Message: "password: 12–128 Unicode characters"} + } + draft, err := model.NewUserDraft(username, name) + if err != nil { + return model.User{}, err + } + hash, err := a.passwords.Hash(password) + if err != nil { + return model.User{}, err + } + draft.PasswordHash = hash + return a.messenger.repo.CreateUser(ctx, draft) +} +func (a *Auth) Login(ctx context.Context, username, password string) (Session, error) { + id, hash, err := a.sessions.Credentials(ctx, username) + if err != nil { + return Session{}, err + } + if !a.passwords.Verify(password, hash) { + return Session{}, model.ErrUnauthorized + } + user, err := a.messenger.repo.GetUser(ctx, id) + if err != nil { + return Session{}, err + } + raw := make([]byte, 32) + if _, err = rand.Read(raw); err != nil { + return Session{}, err + } + token := base64.RawURLEncoding.EncodeToString(raw) + expires := a.now().UTC().Add(a.ttl) + if err = a.sessions.CreateSession(ctx, TokenHash(token), id, expires); err != nil { + return Session{}, err + } + return Session{token, expires, user}, nil +} +func TokenHash(token string) string { + sum := sha256.Sum256([]byte(token)) + return hex.EncodeToString(sum[:]) +} +func (a *Auth) Authenticate(ctx context.Context, token string) (model.User, error) { + if len(token) != 43 { + return model.User{}, model.ErrUnauthorized + } + id, err := a.sessions.AuthenticateSession(ctx, TokenHash(token)) + if err != nil { + return model.User{}, err + } + return a.messenger.repo.GetUser(ctx, id) +} +func (a *Auth) Logout(ctx context.Context, token string) error { + return a.sessions.RevokeSession(ctx, TokenHash(token)) +} diff --git a/backend/internal/application/usecase/messenger.go b/backend/internal/application/usecase/messenger.go new file mode 100644 index 00000000..e669c2d6 --- /dev/null +++ b/backend/internal/application/usecase/messenger.go @@ -0,0 +1,102 @@ +package usecase + +import ( + "context" + + "backend/internal/domain/model" + "backend/internal/domain/repository" + + "github.com/google/uuid" +) + +const chatsCursorScope = "chats" + +// Page — страница списка; NextCursor == nil, если следующей записи нет. +type Page[T any] struct { + Items []T + NextCursor *string +} + +type Messenger struct { + repo repository.Repository +} + +func NewMessenger(repo repository.Repository) *Messenger { + return &Messenger{repo: repo} +} + +func (m *Messenger) CreateChat(ctx context.Context, caller uuid.UUID, title string, memberIDs []uuid.UUID) (model.Chat, error) { + draft, err := model.NewChatDraft(caller, title, memberIDs) + if err != nil { + return model.Chat{}, err + } + return m.repo.CreateChat(ctx, draft) +} + +func (m *Messenger) ListChats(ctx context.Context, caller uuid.UUID, limit *int, cursor *string) (Page[model.Chat], error) { + q, err := model.NewPageQuery(limit, cursor, chatsCursorScope) + if err != nil { + return Page[model.Chat]{}, err + } + chats, more, err := m.repo.ListChats(ctx, caller, q) + if err != nil { + return Page[model.Chat]{}, err + } + return newPage(chats, more, chatsCursorScope, model.Chat.Position), nil +} + +// GetChat отдаёт чат только участнику; постороннему — ErrNotFound, чтобы не +// раскрывать существование чужого чата. +func (m *Messenger) GetChat(ctx context.Context, caller, chatID uuid.UUID) (model.Chat, error) { + chat, err := m.repo.GetChat(ctx, chatID) + if err != nil { + return model.Chat{}, err + } + if !chat.HasMember(caller) { + return model.Chat{}, model.ErrNotFound + } + return chat, nil +} + +// SendMessage сначала проверяет доступ, затем тело: посторонний получает 404 +// даже на невалидное сообщение. Проверка членства и запись не атомарны, но +// участники чата неизменяемы, а чаты не удаляются, поэтому гонки здесь нет. +func (m *Messenger) SendMessage(ctx context.Context, caller, chatID uuid.UUID, text, key string) (model.Message, error) { + if _, err := m.GetChat(ctx, caller, chatID); err != nil { + return model.Message{}, err + } + draft, err := model.NewMessageDraft(chatID, caller, text) + if err != nil { + return model.Message{}, err + } + draft, err = model.WithKey(draft, key) + if err != nil { + return model.Message{}, err + } + return m.repo.CreateMessage(ctx, draft) +} + +func (m *Messenger) ListMessages(ctx context.Context, caller, chatID uuid.UUID, limit *int, cursor *string) (Page[model.Message], error) { + if _, err := m.GetChat(ctx, caller, chatID); err != nil { + return Page[model.Message]{}, err + } + scope := "messages:" + chatID.String() + q, err := model.NewPageQuery(limit, cursor, scope) + if err != nil { + return Page[model.Message]{}, err + } + messages, more, err := m.repo.ListMessages(ctx, chatID, q) + if err != nil { + return Page[model.Message]{}, err + } + return newPage(messages, more, scope, model.Message.Position), nil +} + +func newPage[T any](items []T, more bool, scope string, position func(T) model.Position) Page[T] { + page := Page[T]{Items: items} + if more && len(items) > 0 { + next := model.EncodeCursor(scope, position(items[len(items)-1])) + page.NextCursor = &next + } + return page +} diff --git a/backend/internal/config/config.go b/backend/internal/config/config.go new file mode 100644 index 00000000..4aab77ce --- /dev/null +++ b/backend/internal/config/config.go @@ -0,0 +1,86 @@ +package config + +import ( + "fmt" + "os" + "strings" + "time" + + "github.com/spf13/viper" +) + +// Config приходит только из окружения (12-factor): в контейнер не копируются +// ни .env, ни файлы конфигурации. Значения по умолчанию — ниже. +type Config struct { + Host string `mapstructure:"APP_HOST"` + Port int `mapstructure:"APP_PORT"` + Env string `mapstructure:"APP_ENV"` + LogLevel string `mapstructure:"LOG_LEVEL"` + ShutdownTimeout time.Duration `mapstructure:"SHUTDOWN_TIMEOUT"` + MaxBodyBytes int64 `mapstructure:"MAX_BODY_BYTES"` + MaxInflight int `mapstructure:"MAX_INFLIGHT"` + MaxQueue int `mapstructure:"MAX_QUEUE"` + QueueTimeout time.Duration `mapstructure:"QUEUE_TIMEOUT"` + DatabaseURLFile string `mapstructure:"DATABASE_URL_FILE"` + CacheURLFile string `mapstructure:"CACHE_URL_FILE"` + SessionTTLSeconds int `mapstructure:"SESSION_TTL_SECONDS"` + MaxConns int32 `mapstructure:"PG_MAX_CONNS"` +} + +var defaults = map[string]any{ + "APP_HOST": "0.0.0.0", + "APP_PORT": 8080, + "APP_ENV": "lab", + "LOG_LEVEL": "info", + "SHUTDOWN_TIMEOUT": "8s", + "MAX_BODY_BYTES": 64 << 10, + "MAX_INFLIGHT": 4, + "MAX_QUEUE": 32, + "QUEUE_TIMEOUT": "1s", + "DATABASE_URL_FILE": "/run/secrets/database_url", + "CACHE_URL_FILE": "/run/secrets/cache_url", + "SESSION_TTL_SECONDS": 3600, + "PG_MAX_CONNS": 8, +} + +func Load() (Config, error) { + v := viper.New() + for key, value := range defaults { + v.SetDefault(key, value) + } + v.AutomaticEnv() + var cfg Config + if err := v.Unmarshal(&cfg); err != nil { + return Config{}, fmt.Errorf("parse config: %w", err) + } + if cfg.ShutdownTimeout <= 0 || cfg.ShutdownTimeout > 9*time.Second { + return Config{}, fmt.Errorf("SHUTDOWN_TIMEOUT must be in (0, 9s]: docker stop ждёт 10 с") + } + if cfg.SessionTTLSeconds < 1 || cfg.SessionTTLSeconds > 86400 { + return Config{}, fmt.Errorf("SESSION_TTL_SECONDS must be 1..86400") + } + if cfg.MaxConns < 1 || cfg.MaxConns > 64 { + return Config{}, fmt.Errorf("PG_MAX_CONNS must be 1..64") + } + if cfg.MaxInflight < 1 || cfg.MaxInflight > 4 || cfg.MaxQueue < 0 || cfg.MaxQueue > 128 || cfg.QueueTimeout <= 0 || cfg.QueueTimeout > 2*time.Second { + return Config{}, fmt.Errorf("HTTP gate exceeds the tested resource budget") + } + if cfg.MaxBodyBytes < 1 || cfg.MaxBodyBytes > 65536 { + return Config{}, fmt.Errorf("MAX_BODY_BYTES must be 1..65536") + } + return cfg, nil +} + +func (c Config) Addr() string { return fmt.Sprintf("%s:%d", c.Host, c.Port) } + +func ReadSecret(path string) (string, error) { + b, e := os.ReadFile(path) + if e != nil { + return "", fmt.Errorf("required secret file unavailable") + } + v := strings.TrimSpace(string(b)) + if v == "" { + return "", fmt.Errorf("required secret is empty") + } + return v, nil +} diff --git a/backend/internal/config/config_test.go b/backend/internal/config/config_test.go new file mode 100644 index 00000000..7a82caa9 --- /dev/null +++ b/backend/internal/config/config_test.go @@ -0,0 +1,24 @@ +package config + +import "testing" + +func TestRejectsConfigurationOutsideResourceBudget(t *testing.T) { + for _, tc := range []struct{ key, value string }{{"MAX_INFLIGHT", "0"}, {"MAX_INFLIGHT", "5"}, {"MAX_QUEUE", "-1"}, {"MAX_QUEUE", "129"}, {"QUEUE_TIMEOUT", "0s"}, {"QUEUE_TIMEOUT", "3s"}, {"MAX_BODY_BYTES", "0"}, {"MAX_BODY_BYTES", "65537"}, {"PG_MAX_CONNS", "0"}, {"PG_MAX_CONNS", "65"}, {"SESSION_TTL_SECONDS", "0"}, {"SESSION_TTL_SECONDS", "86401"}} { + t.Run(tc.key+tc.value, func(t *testing.T) { + t.Setenv(tc.key, tc.value) + if _, e := Load(); e == nil { + t.Fatal("accepted configuration beyond tested bounds") + } + }) + } +} +func TestPoolSizeIsConfigurableWithinBounds(t *testing.T) { + t.Setenv("PG_MAX_CONNS", "1") + cfg, e := Load() + if e != nil { + t.Fatal(e) + } + if cfg.MaxConns != 1 { + t.Fatal("configured pool size ignored") + } +} diff --git a/backend/internal/domain/model/chat.go b/backend/internal/domain/model/chat.go new file mode 100644 index 00000000..609b152b --- /dev/null +++ b/backend/internal/domain/model/chat.go @@ -0,0 +1,52 @@ +package model + +import ( + "slices" + "time" + + "github.com/google/uuid" +) + +const maxChatMembers = 100 + +// Chat неизменяем после создания: участники задаются один раз, удаления в API нет. +type Chat struct { + ID uuid.UUID + Title string + MemberIDs []uuid.UUID + CreatedAt time.Time +} + +func (c Chat) HasMember(userID uuid.UUID) bool { + return slices.Contains(c.MemberIDs, userID) +} + +// ChatDraft — проверенные данные нового чата. Существование участников +// проверяет хранилище атомарно с созданием. +type ChatDraft struct { + Creator uuid.UUID + Title string + MemberIDs []uuid.UUID +} + +func NewChatDraft(creator uuid.UUID, title string, memberIDs []uuid.UUID) (ChatDraft, error) { + if err := requireText("title", title, 1, 100); err != nil { + return ChatDraft{}, err + } + if len(memberIDs) == 0 || len(memberIDs) > maxChatMembers { + return ChatDraft{}, invalidf("member_ids: от 1 до %d участников", maxChatMembers) + } + seen := make(map[uuid.UUID]struct{}, len(memberIDs)) + for _, id := range memberIDs { + if _, dup := seen[id]; dup { + return ChatDraft{}, invalidf("member_ids: повторяющийся участник") + } + seen[id] = struct{}{} + } + if _, ok := seen[creator]; !ok { + return ChatDraft{}, invalidf("member_ids: должен содержать создателя чата") + } + return ChatDraft{Creator: creator, Title: title, MemberIDs: slices.Clone(memberIDs)}, nil +} + +func (c Chat) Position() Position { return Position{CreatedAt: c.CreatedAt, ID: c.ID} } diff --git a/backend/internal/domain/model/errors.go b/backend/internal/domain/model/errors.go new file mode 100644 index 00000000..cb9a4593 --- /dev/null +++ b/backend/internal/domain/model/errors.go @@ -0,0 +1,32 @@ +package model + +import ( + "errors" + "fmt" +) + +var ( + ErrUnavailable = errors.New("dependency unavailable") + ErrConflict = errors.New("conflict") + ErrNotFound = errors.New("not found") + ErrUnauthorized = errors.New("unauthorized") + ErrUsernameTaken = errors.New("username taken") + // ErrStorageFull — исчерпан бюджет памяти хранилища. Подтверждённые данные + // не вытесняются, поэтому новые записи отклоняются, а чтение продолжает работать. + ErrStorageFull = errors.New("storage full") + // ErrUnknownMember возвращает хранилище, если среди участников нового чата + // есть несуществующий пользователь; для клиента это ошибка ввода (400). + ErrUnknownMember error = &ValidationError{Message: "member_ids: неизвестный пользователь"} +) + +// ValidationError — нарушение правил входных данных; Message безопасно +// показывать клиенту. +type ValidationError struct { + Message string +} + +func (e *ValidationError) Error() string { return e.Message } + +func invalidf(format string, args ...any) error { + return &ValidationError{Message: fmt.Sprintf(format, args...)} +} diff --git a/backend/internal/domain/model/message.go b/backend/internal/domain/model/message.go new file mode 100644 index 00000000..29d3d3b8 --- /dev/null +++ b/backend/internal/domain/model/message.go @@ -0,0 +1,51 @@ +package model + +import ( + "crypto/sha256" + "encoding/hex" + "regexp" + "time" + + "github.com/google/uuid" +) + +const MaxMessageRunes = 4000 + +type Message struct { + ID uuid.UUID + ChatID uuid.UUID + SenderID uuid.UUID + Text string + CreatedAt time.Time +} + +// MessageDraft — проверенное сообщение; отправитель берётся из идентификации, +// а не из тела запроса. +type MessageDraft struct { + ChatID uuid.UUID + SenderID uuid.UUID + Text string + Key string + PayloadHash string +} + +var keyPattern = regexp.MustCompile(`^[A-Za-z0-9._:-]{1,128}$`) + +func WithKey(d MessageDraft, key string) (MessageDraft, error) { + if !keyPattern.MatchString(key) { + return MessageDraft{}, invalidf("Idempotency-Key: 1–128 ASCII characters required") + } + sum := sha256.Sum256([]byte(d.Text)) + d.Key = key + d.PayloadHash = hex.EncodeToString(sum[:]) + return d, nil +} + +func NewMessageDraft(chatID, senderID uuid.UUID, text string) (MessageDraft, error) { + if err := requireText("text", text, 1, MaxMessageRunes); err != nil { + return MessageDraft{}, err + } + return MessageDraft{ChatID: chatID, SenderID: senderID, Text: text}, nil +} + +func (m Message) Position() Position { return Position{CreatedAt: m.CreatedAt, ID: m.ID} } diff --git a/backend/internal/domain/model/model_test.go b/backend/internal/domain/model/model_test.go new file mode 100644 index 00000000..e47d1bf2 --- /dev/null +++ b/backend/internal/domain/model/model_test.go @@ -0,0 +1,126 @@ +package model + +import ( + "errors" + "strings" + "testing" + "time" + + "github.com/google/uuid" +) + +func isValidationError(err error) bool { + var v *ValidationError + return errors.As(err, &v) +} + +func TestNewUserDraft(t *testing.T) { + t.Parallel() + cases := []struct { + name, username, display string + ok bool + }{ + {"minimal", "abc", "A", true}, + {"max username 32", strings.Repeat("a", 32), "A", true}, + {"username too short", "ab", "A", false}, + {"username too long", strings.Repeat("a", 33), "A", false}, + {"uppercase rejected", "Alice", "A", false}, + {"cyrillic username rejected", "алиса", "A", false}, + {"display 100 emoji ok", "abc", strings.Repeat("😀", 100), true}, + {"display 101 code points rejected", "abc", strings.Repeat("ж", 101), false}, + {"display whitespace only", "abc", " \t\n", false}, + {"display empty", "abc", "", false}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + _, err := NewUserDraft(tc.username, tc.display) + if tc.ok && err != nil { + t.Fatalf("unexpected error: %v", err) + } + if !tc.ok && !isValidationError(err) { + t.Fatalf("want ValidationError, got %v", err) + } + }) + } +} + +func TestNewChatDraft(t *testing.T) { + t.Parallel() + me, other := uuid.New(), uuid.New() + tooMany := []uuid.UUID{me} + for range 100 { + tooMany = append(tooMany, uuid.New()) + } + cases := []struct { + name string + members []uuid.UUID + ok bool + }{ + {"creator only", []uuid.UUID{me}, true}, + {"two members", []uuid.UUID{me, other}, true}, + {"empty", nil, false}, + {"creator missing", []uuid.UUID{other}, false}, + {"duplicate member", []uuid.UUID{me, other, other}, false}, + {"over 100 members", tooMany, false}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + _, err := NewChatDraft(me, "Чат", tc.members) + if tc.ok != (err == nil) { + t.Fatalf("ok=%v, err=%v", tc.ok, err) + } + }) + } +} + +func TestNewMessageDraftLimitsInCodePoints(t *testing.T) { + t.Parallel() + if _, err := NewMessageDraft(uuid.New(), uuid.New(), strings.Repeat("👋", MaxMessageRunes)); err != nil { + t.Fatalf("4000 four-byte code points must pass: %v", err) + } + if _, err := NewMessageDraft(uuid.New(), uuid.New(), strings.Repeat("a", MaxMessageRunes+1)); !isValidationError(err) { + t.Fatalf("4001 code points must be rejected, got %v", err) + } +} + +func TestCursorRoundTripAndScope(t *testing.T) { + t.Parallel() + pos := Position{CreatedAt: time.Date(2026, 9, 1, 12, 0, 0, 123456000, time.UTC), ID: uuid.New()} + cursor := EncodeCursor("messages:a", pos) + + q, err := NewPageQuery(nil, &cursor, "messages:a") + if err != nil || q.After == nil || *q.After != pos || q.Limit != DefaultPageLimit { + t.Fatalf("round trip failed: %+v, %v", q, err) + } + if _, err := NewPageQuery(nil, &cursor, "messages:b"); !isValidationError(err) { + t.Fatalf("cursor of another resource must be rejected, got %v", err) + } + for _, bad := range []string{"", "!!!", EncodeCursor("x", pos)[:5]} { + if _, err := NewPageQuery(nil, &bad, "messages:a"); !isValidationError(err) { + t.Fatalf("garbage cursor %q must be rejected, got %v", bad, err) + } + } +} + +func TestPageLimitBounds(t *testing.T) { + t.Parallel() + for limit, ok := range map[int]bool{0: false, 1: true, 100: true, 101: false, -1: false} { + _, err := NewPageQuery(&limit, nil, "chats") + if ok != (err == nil) { + t.Errorf("limit=%d: ok=%v, err=%v", limit, ok, err) + } + } +} + +func TestPositionOrderTiesBrokenByID(t *testing.T) { + t.Parallel() + at := time.Now() + low := Position{CreatedAt: at, ID: uuid.MustParse("00000000-0000-4000-8000-000000000001")} + high := Position{CreatedAt: at, ID: uuid.MustParse("ffffffff-0000-4000-8000-000000000000")} + later := Position{CreatedAt: at.Add(time.Microsecond), ID: low.ID} + if !high.After(low) || low.After(high) || !later.After(high) || low.After(low) { + t.Fatal("order must be (created_at, id) ascending") + } +} diff --git a/backend/internal/domain/model/page.go b/backend/internal/domain/model/page.go new file mode 100644 index 00000000..4eda2571 --- /dev/null +++ b/backend/internal/domain/model/page.go @@ -0,0 +1,84 @@ +package model + +import ( + "bytes" + "encoding/base64" + "strconv" + "strings" + "time" + + "github.com/google/uuid" +) + +const ( + DefaultPageLimit = 50 + MaxPageLimit = 100 +) + +// Position — ключ keyset-пагинации: история упорядочена по (created_at, id). +type Position struct { + CreatedAt time.Time + ID uuid.UUID +} + +// After сообщает, стоит ли p строго после other в порядке (created_at, id). +func (p Position) After(other Position) bool { + if !p.CreatedAt.Equal(other.CreatedAt) { + return p.CreatedAt.After(other.CreatedAt) + } + return bytes.Compare(p.ID[:], other.ID[:]) > 0 +} + +// PageQuery — проверенный запрос страницы: limit 1–100 и позиция после +// последнего элемента предыдущей страницы (nil — с начала). +type PageQuery struct { + Limit int + After *Position +} + +// NewPageQuery проверяет limit и курсор. scope привязывает курсор к ресурсу: +// курсор истории одного чата не подходит к другому чату или к списку чатов. +func NewPageQuery(limit *int, cursor *string, scope string) (PageQuery, error) { + q := PageQuery{Limit: DefaultPageLimit} + if limit != nil { + if *limit < 1 || *limit > MaxPageLimit { + return PageQuery{}, invalidf("limit: от 1 до %d", MaxPageLimit) + } + q.Limit = *limit + } + if cursor != nil { + pos, err := decodeCursor(*cursor, scope) + if err != nil { + return PageQuery{}, err + } + q.After = &pos + } + return q, nil +} + +// EncodeCursor делает непрозрачную для клиента строку из позиции и scope. +func EncodeCursor(scope string, p Position) string { + raw := scope + "|" + strconv.FormatInt(p.CreatedAt.UnixMicro(), 10) + "|" + p.ID.String() + return base64.RawURLEncoding.EncodeToString([]byte(raw)) +} + +func decodeCursor(cursor, scope string) (Position, error) { + errBad := invalidf("cursor: некорректное значение") + raw, err := base64.RawURLEncoding.DecodeString(cursor) + if err != nil { + return Position{}, errBad + } + parts := strings.Split(string(raw), "|") + if len(parts) != 3 || parts[0] != scope { + return Position{}, errBad + } + micros, err := strconv.ParseInt(parts[1], 10, 64) + if err != nil { + return Position{}, errBad + } + id, err := uuid.Parse(parts[2]) + if err != nil { + return Position{}, errBad + } + return Position{CreatedAt: time.UnixMicro(micros).UTC(), ID: id}, nil +} diff --git a/backend/internal/domain/model/postgres_text_test.go b/backend/internal/domain/model/postgres_text_test.go new file mode 100644 index 00000000..6739cebc --- /dev/null +++ b/backend/internal/domain/model/postgres_text_test.go @@ -0,0 +1,13 @@ +package model + +import "testing" + +func TestRejectsNULInPersistedText(t *testing.T) { + for _, field := range []string{"display_name", "title", "text"} { + t.Run(field, func(t *testing.T) { + if err := requireText(field, "a\x00b", 1, 4000); err == nil { + t.Fatal("PostgreSQL text must reject NUL as a validation error") + } + }) + } +} diff --git a/backend/internal/domain/model/text.go b/backend/internal/domain/model/text.go new file mode 100644 index 00000000..789696b0 --- /dev/null +++ b/backend/internal/domain/model/text.go @@ -0,0 +1,24 @@ +package model + +import ( + "strings" + "unicode/utf8" +) + +// requireText проверяет обязательную строку: длина в Unicode code points +// (не в байтах) и запрет строк только из пробельных символов. +func requireText(field, value string, minLen, maxLen int) error { + if strings.ContainsRune(value, 0) { + return invalidf("%s: NUL недопустим в PostgreSQL text", field) + } + if !utf8.ValidString(value) { + return invalidf("%s: некорректный UTF-8", field) + } + if strings.TrimSpace(value) == "" { + return invalidf("%s: пустая строка", field) + } + if n := utf8.RuneCountInString(value); n < minLen || n > maxLen { + return invalidf("%s: длина должна быть от %d до %d символов", field, minLen, maxLen) + } + return nil +} diff --git a/backend/internal/domain/model/user.go b/backend/internal/domain/model/user.go new file mode 100644 index 00000000..ccecf355 --- /dev/null +++ b/backend/internal/domain/model/user.go @@ -0,0 +1,34 @@ +package model + +import ( + "regexp" + "time" + + "github.com/google/uuid" +) + +var usernamePattern = regexp.MustCompile(`^[a-z0-9_]{3,32}$`) + +type User struct { + ID uuid.UUID + Username string + DisplayName string + CreatedAt time.Time +} + +// UserDraft — проверенные данные нового пользователя; ID и время назначает хранилище. +type UserDraft struct { + Username string + DisplayName string + PasswordHash string +} + +func NewUserDraft(username, displayName string) (UserDraft, error) { + if !usernamePattern.MatchString(username) { + return UserDraft{}, invalidf("username: допустимо [a-z0-9_], от 3 до 32 символов") + } + if err := requireText("display_name", displayName, 1, 100); err != nil { + return UserDraft{}, err + } + return UserDraft{Username: username, DisplayName: displayName}, nil +} diff --git a/backend/internal/domain/port/auth.go b/backend/internal/domain/port/auth.go new file mode 100644 index 00000000..92b5b279 --- /dev/null +++ b/backend/internal/domain/port/auth.go @@ -0,0 +1,18 @@ +package port + +import ( + "context" + "github.com/google/uuid" + "time" +) + +type Passwords interface { + Hash(string) (string, error) + Verify(string, string) bool +} +type Sessions interface { + Credentials(context.Context, string) (uuid.UUID, string, error) + CreateSession(context.Context, string, uuid.UUID, time.Time) error + AuthenticateSession(context.Context, string) (uuid.UUID, error) + RevokeSession(context.Context, string) error +} diff --git a/backend/internal/domain/repository/repository.go b/backend/internal/domain/repository/repository.go new file mode 100644 index 00000000..45ebfab2 --- /dev/null +++ b/backend/internal/domain/repository/repository.go @@ -0,0 +1,49 @@ +// Package repository — порт персистентности. В lab1 его реализует хранилище +// в памяти процесса, с lab2 — PostgreSQL; ядро от этой замены не меняется. +package repository + +import ( + "context" + + "backend/internal/domain/model" + "backend/internal/domain/port" + + "github.com/google/uuid" +) + +// Repository assigns IDs and database timestamps. Keyset order is (created_at, id); +// concurrent commits do not provide insertion order or a traversal snapshot. +// Каждый метод атомарен сам по себе. +type Repository interface { + UserRepository + ChatRepository + MessageRepository +} + +type Persistent interface { + Repository + port.Sessions +} + +type UserRepository interface { + // CreateUser: model.ErrUsernameTaken, model.ErrStorageFull. + CreateUser(ctx context.Context, draft model.UserDraft) (model.User, error) + // GetUser: model.ErrNotFound. + GetUser(ctx context.Context, id uuid.UUID) (model.User, error) +} + +type ChatRepository interface { + // CreateChat: model.ErrUnknownMember, model.ErrStorageFull. + CreateChat(ctx context.Context, draft model.ChatDraft) (model.Chat, error) + // GetChat: model.ErrNotFound. + GetChat(ctx context.Context, id uuid.UUID) (model.Chat, error) + // ListChats возвращает чаты участника и признак, что есть следующая страница. + ListChats(ctx context.Context, memberID uuid.UUID, q model.PageQuery) ([]model.Chat, bool, error) +} + +type MessageRepository interface { + // CreateMessage: model.ErrNotFound (нет чата), model.ErrStorageFull. + CreateMessage(ctx context.Context, draft model.MessageDraft) (model.Message, error) + // ListMessages возвращает страницу истории и признак следующей страницы. + ListMessages(ctx context.Context, chatID uuid.UUID, q model.PageQuery) ([]model.Message, bool, error) +} diff --git a/backend/pkg/logger/logger.go b/backend/pkg/logger/logger.go new file mode 100644 index 00000000..e76c339d --- /dev/null +++ b/backend/pkg/logger/logger.go @@ -0,0 +1,18 @@ +package logger + +import ( + "os" + "time" + + "github.com/rs/zerolog" +) + +// New — JSON-логи в stdout, их собирает docker logs. +func New(level string) zerolog.Logger { + lvl, err := zerolog.ParseLevel(level) + if err != nil || level == "" { + lvl = zerolog.InfoLevel + } + zerolog.TimeFieldFormat = time.RFC3339Nano + return zerolog.New(os.Stdout).Level(lvl).With().Timestamp().Logger() +} diff --git a/backend/pkg/server/server.go b/backend/pkg/server/server.go new file mode 100644 index 00000000..85d496f0 --- /dev/null +++ b/backend/pkg/server/server.go @@ -0,0 +1,29 @@ +package server + +import ( + "context" + "net/http" + "time" +) + +type Server struct { + httpServer *http.Server +} + +func New(addr string, handler http.Handler) *Server { + return &Server{httpServer: &http.Server{ + Addr: addr, + Handler: handler, + ReadHeaderTimeout: 5 * time.Second, + ReadTimeout: 15 * time.Second, + WriteTimeout: 15 * time.Second, + IdleTimeout: 60 * time.Second, + MaxHeaderBytes: 16 << 10, + }} +} + +func (s *Server) ListenAndServe() error { return s.httpServer.ListenAndServe() } + +// Shutdown сразу закрывает слушающий сокет (новые соединения не принимаются) +// и ждёт завершения начатых запросов, но не дольше ctx. +func (s *Server) Shutdown(ctx context.Context) error { return s.httpServer.Shutdown(ctx) } diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 00000000..262b62d2 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,75 @@ +name: vp-lab3-medvedev +x-api: &api + image: vp-medvedev-lab3:local + build: . + cpus: ${API_CPUS:-1} + mem_limit: ${API_MEMORY:-512m} + deploy: + replicas: ${API_REPLICAS:-2} + stop_grace_period: 10s + environment: + APP_PORT: 8080 + SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} + PG_MAX_CONNS: ${PG_MAX_CONNS:-8} + GOMEMLIMIT: ${GO_MEMORY_LIMIT:-400MiB} + secrets: [database_url, cache_url] + depends_on: + migrate: {condition: service_completed_successfully} + valkey: {condition: service_started} + networks: [private] +services: + postgres: + image: postgres:18.6@sha256:74935e72241653ca55e0414067e6d8763aceb8a810eb51b452253ec3dcfc4336 + cpus: 2 + mem_limit: 768m + environment: + POSTGRES_USER: messenger + POSTGRES_DB: messenger + POSTGRES_PASSWORD_FILE: /run/secrets/pg_password + secrets: [pg_password] + volumes: [postgres:/var/lib/postgresql] + healthcheck: + test: [CMD-SHELL, pg_isready -U messenger -d messenger] + interval: 2s + timeout: 2s + retries: 30 + networks: [private] + valkey: + image: valkey/valkey:9@sha256:418652cfb58ef879d4978c33553735d7147016032d5aefaa14c828e611eb9dfd + cpus: 0.25 + mem_limit: 128m + command: [valkey-server, /run/secrets/valkey_conf] + secrets: [valkey_conf] + volumes: [valkey:/data] + networks: [private] + migrate: + image: vp-medvedev-lab3:local + build: . + command: [-migrate] + cpus: 0.5 + mem_limit: 256m + secrets: [database_url] + depends_on: + postgres: {condition: service_healthy} + networks: [private] + api: + <<: *api + lb: + image: haproxy:3.2-alpine@sha256:1c3568e520453cc8ba98c39501febcf450429c80e6cc27ecad779961d76e597c + cpus: 0.5 + mem_limit: 128m + ports: ['127.0.0.1:${PUBLIC_PORT:-28203}:8080'] + volumes: ['./config/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro'] + depends_on: + api: {condition: service_started} + networks: [private] +volumes: + postgres: + valkey: +networks: + private: +secrets: + pg_password: {file: .local/pg_password} + database_url: {file: .local/database_url} + cache_url: {file: .local/cache_url} + valkey_conf: {file: .local/valkey.conf} diff --git a/config/haproxy.cfg b/config/haproxy.cfg new file mode 100644 index 00000000..b44924e4 --- /dev/null +++ b/config/haproxy.cfg @@ -0,0 +1,27 @@ +global + log stdout format raw local0 + maxconn 256 +defaults + mode http + log global + timeout connect 1s + timeout client 20s + timeout server 8s + retries 0 +resolvers docker + nameserver dns 127.0.0.11:53 + resolve_retries 2 + timeout resolve 1s + timeout retry 1s + hold valid 1s + hold obsolete 1s +frontend public + bind :8080 + default_backend api +backend api + balance roundrobin + option httpchk + http-check send meth GET uri /health/ready + http-check expect status 200 + default-server inter 500ms fall 2 rise 1 + server-template replica 1-4 api:8080 check resolvers docker resolve-prefer ipv4 init-addr none diff --git a/deploy/k3s/api.yaml b/deploy/k3s/api.yaml new file mode 100644 index 00000000..e0f41760 --- /dev/null +++ b/deploy/k3s/api.yaml @@ -0,0 +1,70 @@ +apiVersion: v1 +kind: Service +metadata: + name: api +spec: + clusterIP: None + selector: {app: api} + ports: [{name: http, port: 8080, targetPort: http}] +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: api + labels: {app: api} +spec: + replicas: 2 + revisionHistoryLimit: 2 + strategy: + rollingUpdate: {maxSurge: 1, maxUnavailable: 0} + selector: + matchLabels: {app: api} + template: + metadata: + labels: {app: api} + spec: + automountServiceAccountToken: false + terminationGracePeriodSeconds: 35 + securityContext: {runAsNonRoot: true, runAsUser: 65532, fsGroup: 65532} + containers: + - name: api + image: vp-messenger:local + imagePullPolicy: Never + ports: [{name: http, containerPort: 8080}] + env: + - {name: APP_HOST, value: 0.0.0.0} + - {name: APP_PORT, value: '8080'} + - {name: PG_MAX_CONNS, value: '8'} + - {name: SESSION_TTL_SECONDS, value: '3600'} + - {name: GOMEMLIMIT, value: 400MiB} + resources: + requests: {cpu: 100m, memory: 128Mi} + limits: {cpu: '1', memory: 512Mi} + securityContext: + allowPrivilegeEscalation: false + capabilities: {drop: [ALL]} + lifecycle: + preStop: + sleep: {seconds: 15} + readinessProbe: + httpGet: {path: /health/ready, port: http} + periodSeconds: 1 + timeoutSeconds: 2 + failureThreshold: 1 + livenessProbe: + httpGet: {path: /health/live, port: http} + periodSeconds: 5 + timeoutSeconds: 2 + startupProbe: + httpGet: {path: /health/live, port: http} + periodSeconds: 1 + failureThreshold: 60 + volumeMounts: [{name: credentials, mountPath: /run/secrets, readOnly: true}] + volumes: + - name: credentials + secret: + secretName: app-config + defaultMode: 0440 + items: + - {key: database_url, path: database_url} + - {key: cache_url, path: cache_url} diff --git a/deploy/k3s/kustomization.yaml b/deploy/k3s/kustomization.yaml new file mode 100644 index 00000000..c638ba6a --- /dev/null +++ b/deploy/k3s/kustomization.yaml @@ -0,0 +1,9 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: messenger +resources: [namespace.yaml, stores.yaml, api.yaml, pingap.yaml] +configMapGenerator: + - name: pingap-config + files: [pingap.toml] +generatorOptions: + disableNameSuffixHash: true diff --git a/deploy/k3s/namespace.yaml b/deploy/k3s/namespace.yaml new file mode 100644 index 00000000..93cf1b76 --- /dev/null +++ b/deploy/k3s/namespace.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: messenger + labels: + app.kubernetes.io/part-of: vp-coursework diff --git a/deploy/k3s/pingap.toml b/deploy/k3s/pingap.toml new file mode 100644 index 00000000..fbba0f6e --- /dev/null +++ b/deploy/k3s/pingap.toml @@ -0,0 +1,20 @@ +[basic] +threads = 1 +grace_period = "8s" +graceful_shutdown_timeout = "10s" + +[upstreams.api] +addrs = ["api.messenger.svc.cluster.local:8080"] +discovery = "dns" +update_frequency = "1s" +health_check = "http://api/health/ready?connection_timeout=1s&read_timeout=1s&check_frequency=1s&success=1&failure=1" +connection_timeout = "1s" +read_timeout = "25s" + +[locations.api] +path = "/" +upstream = "api" + +[servers.http] +addr = "0.0.0.0:8080" +locations = ["api"] diff --git a/deploy/k3s/pingap.yaml b/deploy/k3s/pingap.yaml new file mode 100644 index 00000000..3e0f47f3 --- /dev/null +++ b/deploy/k3s/pingap.yaml @@ -0,0 +1,35 @@ +apiVersion: v1 +kind: Service +metadata: {name: pingap} +spec: + type: LoadBalancer + allocateLoadBalancerNodePorts: false + selector: {app: pingap} + ports: [{name: http, port: 80, targetPort: http}] +--- +apiVersion: apps/v1 +kind: Deployment +metadata: {name: pingap} +spec: + replicas: 1 + selector: {matchLabels: {app: pingap}} + template: + metadata: {labels: {app: pingap}} + spec: + automountServiceAccountToken: false + terminationGracePeriodSeconds: 25 + containers: + - name: pingap + image: vp-pingap:local + imagePullPolicy: Never + args: [-c, /etc/pingap/pingap.toml, --autoreload, --strict] + ports: [{name: http, containerPort: 8080}] + resources: + requests: {cpu: 50m, memory: 32Mi} + limits: {cpu: 500m, memory: 128Mi} + readinessProbe: + tcpSocket: {port: http} + periodSeconds: 1 + volumeMounts: [{name: configuration, mountPath: /etc/pingap, readOnly: true}] + volumes: + - {name: configuration, configMap: {name: pingap-config}} diff --git a/deploy/k3s/stores.yaml b/deploy/k3s/stores.yaml new file mode 100644 index 00000000..3fd4430c --- /dev/null +++ b/deploy/k3s/stores.yaml @@ -0,0 +1,96 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: {name: postgres} +spec: + accessModes: [ReadWriteOnce] + resources: {requests: {storage: 1Gi}} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: {name: valkey} +spec: + accessModes: [ReadWriteOnce] + resources: {requests: {storage: 1Gi}} +--- +apiVersion: v1 +kind: Service +metadata: {name: postgres} +spec: + selector: {app: postgres} + ports: [{port: 5432, targetPort: 5432}] +--- +apiVersion: v1 +kind: Service +metadata: {name: valkey} +spec: + selector: {app: valkey} + ports: [{port: 6379, targetPort: 6379}] +--- +apiVersion: apps/v1 +kind: Deployment +metadata: {name: postgres} +spec: + replicas: 1 + strategy: {type: Recreate} + selector: {matchLabels: {app: postgres}} + template: + metadata: {labels: {app: postgres}} + spec: + automountServiceAccountToken: false + terminationGracePeriodSeconds: 20 + containers: + - name: postgres + image: vp-postgres:local + imagePullPolicy: Never + env: + - {name: POSTGRES_USER, value: messenger} + - {name: POSTGRES_DB, value: messenger} + - {name: POSTGRES_PASSWORD_FILE, value: /run/secrets/pg_password} + resources: + requests: {cpu: 100m, memory: 128Mi} + limits: {cpu: '2', memory: 768Mi} + readinessProbe: + exec: {command: [pg_isready, -h, 127.0.0.1, -U, messenger, -d, messenger]} + periodSeconds: 2 + volumeMounts: + - {name: data, mountPath: /var/lib/postgresql} + - {name: credentials, mountPath: /run/secrets, readOnly: true} + volumes: + - {name: data, persistentVolumeClaim: {claimName: postgres}} + - name: credentials + secret: + secretName: app-config + items: [{key: pg_password, path: pg_password}] +--- +apiVersion: apps/v1 +kind: Deployment +metadata: {name: valkey} +spec: + replicas: 1 + strategy: {type: Recreate} + selector: {matchLabels: {app: valkey}} + template: + metadata: {labels: {app: valkey}} + spec: + automountServiceAccountToken: false + terminationGracePeriodSeconds: 10 + containers: + - name: valkey + image: vp-valkey:local + imagePullPolicy: Never + command: [valkey-server, /run/secrets/valkey_conf] + resources: + requests: {cpu: 50m, memory: 32Mi} + limits: {cpu: 250m, memory: 128Mi} + readinessProbe: + tcpSocket: {port: 6379} + periodSeconds: 2 + volumeMounts: + - {name: data, mountPath: /data} + - {name: credentials, mountPath: /run/secrets, readOnly: true} + volumes: + - {name: data, persistentVolumeClaim: {claimName: valkey}} + - name: credentials + secret: + secretName: app-config + items: [{key: valkey_conf, path: valkey_conf}] diff --git a/docs/archive/compose-report.md b/docs/archive/compose-report.md new file mode 100644 index 00000000..8f7be80b --- /dev/null +++ b/docs/archive/compose-report.md @@ -0,0 +1,62 @@ +# Лабораторная 3. Балансировка и отказ API-реплики + +Автор: Медведев Андрей Михайлович, БПИ2303. Целевая оценка: 5, трек 1 «Цена масштабирования». Реализация, эксперименты и ограничения описаны ниже; оценку выставляет преподаватель. Исходный skeleton: https://gitea.privcloud.tech/mtusi2026/mtusi2026lab3. Команды находятся в [RUN.md](RUN.md). Код, тесты и отчёт подготовлены с помощью Codex и проверены независимым агентом. + +## Архитектура + +Клиент обращается к HAProxy, который распределяет запросы между двумя Go API. PostgreSQL и Valkey общие. Сессии проверяются в PostgreSQL; Valkey кэширует неизменяемые профили. Sticky sessions нет. API не публикуют свои порты на host, единственный вход привязан к localhost:28203. Контейнеры имеют CPU/RAM limits, container_name не задаётся. + +HAProxy проверяет /health/ready каждые 500 мс, исключает backend после двух неудач и возвращает после одного успеха. Docker DNS разрешается повторно через resolver с коротким hold, а не только при старте LB. Конфигурация рассчитана на 1–4 реплики, включая эксперимент 1/2/4. Каждая API-реплика возвращает свой стабильный X-Instance-Id, соответствующий hostname контейнера. Автоматических прозрачных повторов произвольных POST нет. + +SIGTERM переводит readiness в 503 и прекращает приём новых соединений. Graceful shutdown API ограничен 8 секундами, stop_grace_period контейнера равен 10 секундам. Для обычных запросов действует контекст 5 секунд; connection/statement/lock timeouts PostgreSQL согласованы с этим бюджетом. + +## Общая идемпотентность + +Idempotency-Key обязателен для POST сообщения и проверяется по ASCII pattern и длине 1–128. Область ключа задаётся пользователем и чатом; HTTP-операция фиксирована самим endpoint. В PostgreSQL хранятся hash семантического payload, ID сообщения и expiry на 24 часа. + +Резервирование ключа, списание квоты, создание сообщения и ссылка результата выполняются одной транзакцией. Конкурентный повтор ждёт общий UNIQUE constraint; после подтверждения читает тот же Message с 201. Другой payload даёт 409. При откате нет ни сообщения, ни окончательного результата ключа. Неподтверждённый клиентский ответ можно повторить через другую реплику; сессия и доступ к чату проверяются заново. + +Миграции запускает один отдельный service. Проверенная поочерёдная замена использует уже подготовленную совместимую схему. Произвольное несовместимое изменение схемы под трафиком не заявляется. + +## Проверки обязательных уровней + +Публичный smoke и дополнительные HTTP-проверки подтвердили авторизацию, страницы, rollback, конкурентную регистрацию, двенадцать одновременных повторов одного сообщения, конфликт payload и одну сессию через разные реплики. Результаты находятся в evidence/smoke.txt и evidence/acceptance.txt. Persistence сохранил данные и исходный токен после рестарта всех stores и API; файлы restart-before/after фиксируют реальные container ID и StartedAt. + +Каждая API-реплика была остановлена по TARGET_INSTANCE_ID, вторая продолжила чтение и запись. Скрипт проверяет, что выбранный контейнер относится к нужному Compose-проекту; факт остановки записан в stopped-1/2.txt. Public failover учитывает переходные ошибки, проверяет сохранность и отсутствие дублей. Результаты находятся в evidence/failover-1.txt и evidence/failover-2.txt. + +Обязательные операции предыдущей лабы сохраняют свои правила. Source check, OpenAPI validation, Go race tests, lint/depguard, Docker build и генерация проверяются отдельно от smoke. Авторские тестовые данные изолированы случайным prefix, cleanup отказывается удалять чат с посторонним участником. Compose manifest и project name закреплены явно. + +## Исследование масштабирования + +Гипотеза: дополнительные API помогают, только пока они являются узким местом. Нагрузка здесь намеренно состоит из отправки сообщений одним пользователем в один чат. Измерялся closed-loop клиент с concurrency 16, по 5 секунд, два повтора; база данных очищалась только внутри отдельного одноразового исследовательского проекта перед каждым запуском. + +В первой серии суммарный бюджет API постоянен: 2 CPU и 2048 МиБ. Во второй каждая реплика получает 1 CPU и 512 МиБ. PostgreSQL, Valkey и LB сохраняют одинаковые ресурсы. Фактические NanoCpus, Memory, число контейнеров и PG_MAX_CONNS проверялись через Docker и API; снимались CPU/RAM и wait events PostgreSQL. Все запросы основной серии завершились без HTTP-ошибок. + +| Серия | Реплики | CPU API суммарно | RAM API суммарно, МиБ | Успешные RPS, среднее | p95, мс, среднее | +| --- | --- | --- | --- | --- | --- | +| Постоянный бюджет | 1 | 2 | 2048 | 117,70 | 171,00 | +| Постоянный бюджет | 2 | 2 | 2048 | 112,99 | 287,81 | +| Постоянный бюджет | 4 | 2 | 2048 | 116,69 | 346,31 | +| Рост ресурсов | 1 | 1 | 512 | 116,71 | 175,68 | +| Рост ресурсов | 2 | 2 | 1024 | 117,87 | 258,62 | +| Рост ресурсов | 4 | 4 | 2048 | 117,09 | 342,18 | + +Данные и диапазоны двух повторов сохранены в evidence/research/run-ImJmOz/. Графики scaling.svg и pool.svg строятся из исходных JSON, а не из переписанных вручную чисел. + +Для этого профиля насыщение видно уже при одной реплике: добавление API/CPU не повышает throughput, а хвост latency растёт. В 160 снимках активных SQL-запросов ожидание WalSync наблюдалось 151 раз, transactionid 139 раз; категории могут одновременно присутствовать в одном снимке. В исходном коде каждое сообщение обновляет квоту одного sender, поэтому конкурентные транзакции сериализуются на его строке и подтверждают WAL. Число API не снимает эту общую границу. + +## Подтверждённое улучшение + +Отдельно проведена серия ABBA с pool=8 → 1 → 1 → 8 при неизменных 1 API, 2 CPU, 2048 МиБ и том же профиле. Результаты находятся в evidence/research/run-sB0hdP/. Средние успешные RPS составили 117,78 → 118,52, то есть практически не изменились. Средний p95 снизился с 166,86 до 145,97 мс; оба повтора с pool=1 оказались ниже обоих с pool=8. + +Это подтверждённое улучшение хвостовой задержки на одном горячем sender: меньшая конкуренция за общий SQL-ресурс уменьшает очереди, но не ускоряет COMMIT. Для независимых пользователей и другого хранилища вывод не переносится автоматически. Общий default pool=8 сохранён; экспериментальная настройка доступна через PG_MAX_CONNS. + +## Замена под нагрузкой и ограничения + +В том же отдельном проекте обе исходные API по очереди заменены новыми контейнерами под непрерывной 30-секундной нагрузкой. Между заменами проверялась готовность двух реплик; успешные записи должны были продолжаться, а генератор оставаться активным. Сохранены старые ID и количества сообщений до/после каждой замены. + +Получено 2684 успешных запроса и 46 переходных ошибок, доля ошибок 1,685%, успешные RPS 89,27. Это допустимые обнаруженные ошибки во время замены, а не zero-downtime обещание. Проверена замена контейнеров одного собранного образа; upgrade с несовместимой миграцией не испытывался. + +Стенд находится на одном host и имеет единственные PostgreSQL, LB и storage. Поэтому отказ API проверен, а потеря host/БД/LB не покрыта. Closed-loop клиент имеет coordinated omission; latency относится только к успешным запросам, ошибки считаются отдельно. Серии короткие и не доказывают универсальный предел сервера. Объёмы, ресурсы, raw JSON и ограничения сохранены для повторения. + +На защите показать две реальные реплики с одной сессией, конкурентный одинаковый ключ, остановку каждой реплики, повтор без дубля, persistence и графики. Объяснить, почему четыре API не превращают единственную PostgreSQL в отказоустойчивую БД и не отменяют транзакционную сериализацию. diff --git a/docs/archive/compose-run.md b/docs/archive/compose-run.md new file mode 100644 index 00000000..40b147c7 --- /dev/null +++ b/docs/archive/compose-run.md @@ -0,0 +1,74 @@ +# Запуск лабораторной 3 + +> Историческая инструкция Compose/HAProxy. Основной путь теперь описан в ../../RUN.md. Для старых action helpers явно задайте VP_RUNTIME=compose; прежний runner исследования сохранён как student-tests/research-compose.ts. Числа этого варианта не являются измерениями k3s/Pingap. + +Автор: Медведев Андрей Михайлович, БПИ2303. Исходное задание и контракт сохранены в README.md и contracts/. Реализация находится в backend/, дополнительные проверки в student-tests/. + +Нужны Docker Engine с Compose, Bun 1.4 и Python 3.9+. Для Go-тестов на хосте нужен Go 1.27.2 или новее. Проверенный стенд: Linux x86_64, Docker 29.9.2, Compose 5.6.1, Bun 1.4.4; образ компилируется Go 1.27.2. Образы PostgreSQL 18.6 и Valkey 9 закреплены digest в compose.yaml. + +Команды выполняются из этого каталога. scripts/compose.sh закрепляет manifest и имя vp-lab3-medvedev, чтобы переменные другого проекта не перенаправили операции. + +```sh +bun --no-env-file scripts/bootstrap.ts +./scripts/compose.sh up -d --build +BASE_URL=http://127.0.0.1:28203 bun --no-env-file student-tests/wait.ts +python3 -m venv .venv +.venv/bin/pip install -r requirements-dev.txt +make check +make validate PYTHON=.venv/bin/python +make test BASE_URL=http://127.0.0.1:28203 +BASE_URL=http://127.0.0.1:28203 bun --no-env-file student-tests/acceptance.ts +make test-persistence BASE_URL=http://127.0.0.1:28203 ACTION_SCRIPT=scripts/restart.sh +cd backend +go test -race ./... +go tool golangci-lint run +go generate ./... +``` + +Bootstrap создаёт отдельные случайные учебные credentials в .local/ и не печатает их. Каталог исключён из git и Docker context. Существующие файлы не перезаписываются. Миграции запускает отдельный service migrate; API не выполняет их конкурентно. + +HTTP доступен только через localhost. Все данные тестов синтетические; публичные тесты сохраняют свой набор данных для демонстрации, дополнительные acceptance-тесты удаляют только свой случайный набор. Пароли и сессии не выводятся в отчёты. + +Обычная остановка сохраняет volumes: + +```sh +./scripts/compose.sh stop +``` + +Повторный запуск с сохранением данных: + +```sh +./scripts/compose.sh up -d +``` + +Только для намеренного полного сброса собственных учебных данных: + +```sh +./scripts/compose.sh down --volumes +``` + +Для проверки отказа запустите публичный сценарий. Он передаёт реальный TARGET_INSTANCE_ID hook-скрипту; после проверки верните обе реплики и дождитесь готовности. + +```sh +make test-failover BASE_URL=http://127.0.0.1:28203 ACTION_SCRIPT=scripts/stop-one.sh +./scripts/compose.sh up -d +BASE_URL=http://127.0.0.1:28203 bun --no-env-file student-tests/wait.ts +``` + +Чтобы проверить вторую реплику, повторите сценарий после восстановления; фактический остановленный контейнер записывается в evidence/stop-one-after.txt. + +Трек 1 запускается на omarchy без игры; скрипт проверяет это до и после замеров. Он создаёт отдельный случайный Compose-проект на localhost:28303, сравнивает 1/2/4 реплики, выполняет ABBA для пула и замену под нагрузкой, затем удаляет только свои containers/volumes. Обычный демонстрационный стенд сохраняется. + +```sh +bun --no-env-file student-tests/research.ts +bun --no-env-file student-tests/research.ts --pool-only +``` + +Первой команды достаточно для полного исследования; вторая отдельно повторяет четыре замера пула. Результат каждого запуска появляется в новом evidence/research/run-*. Для приложенных графиков: + +```sh +.venv/bin/pip install -r requirements-plots.txt +.venv/bin/python student-tests/plot_research.py evidence/research/run-ImJmOz/summary.json --pool-summary evidence/research/run-sB0hdP/summary.json +``` + +Подтверждённые результаты и ограничения перечислены в REPORT.md. Автоматические проверки не выставляют оценку преподавателя. diff --git a/docs/archive/implementation.md b/docs/archive/implementation.md new file mode 100644 index 00000000..6e6e63f4 --- /dev/null +++ b/docs/archive/implementation.md @@ -0,0 +1,15 @@ +# Implementation plan and boundaries + +Archived: this inherited lab2 plan is retained as historical context only. The completed lab3 implementation, results and limitations are documented in ../../REPORT.md; startup instructions are in ../../RUN.md. + +This repository carries our lab1 domain, pagination, HTTP/error handling, bounded queue and shutdown code into the original lab2 skeleton. The lab1 memory adapter and its obsolete HTTP identity tests are not carried forward. + +PostgreSQL is authoritative for users, passwords, sessions, chats, membership and messages. Valkey caches immutable public profiles for 60 seconds; no chat/message/session cache is used. Authentication always reads the session from PostgreSQL, and cache failure falls back to PostgreSQL within an 80 ms budget. Logout deletes the persisted token hash. Cache contents contain no password or bearer token. + +Transactions: chat allocation + chat row + membership; sender quota + message; session owner lock + expiry cleanup + session insertion. PostgreSQL constraints enforce username uniqueness and foreign keys. Maximums: 1000 created chats and 1,000,000 messages per owner; 100 unexpired sessions. No user data is silently deleted. The history index covers `(chat_id,created_at,id)` and queries fetch only `limit+1` rows. Keyset traversal is not a snapshot; writes whose wall-clock timestamps fall before a consumed cursor can be missed during concurrent traversal. + +Argon2id uses a random 16-byte salt, 32 MiB, two iterations, one lane, 32-byte result. Tokens use 32 random bytes; PostgreSQL stores only SHA-256 of the token. SHA-256 is appropriate for high-entropy tokens, not passwords. The API gate bounds concurrent KDF calls to four. PostgreSQL pool: eight connections, statement timeout 2 s, lock timeout 1 s, connect timeout 1 s; request context 5 s. + +Readiness checks PostgreSQL. Valkey is optional to safe operation; its absence is observable through cache hit statistics and failure tests, not an anonymous-authentication fallback. HTTP is bound to localhost and uses only generated synthetic data. + +Research: compare history queries over at least 100,000 skewed messages; restore a backup into a new database, compare row counts and selected message bytes. See `REPORT.md` for actual results; planned experiments are not evidence. diff --git a/docs/archive/k3s-migration.md b/docs/archive/k3s-migration.md new file mode 100644 index 00000000..cb4d1bef --- /dev/null +++ b/docs/archive/k3s-migration.md @@ -0,0 +1,36 @@ +# k3s and Pingap migration + +Completed implementation specification. Native source, acceptance, measurements and reports are complete. Final ZIP verification and file hashes are recorded separately by the parent delivery workflow in DELIVERY.json. + +Approved by the owner: replace the lab3 and lab4 runtime with k3s + Pingap, following the azur-games ingress pattern. Keep the existing Compose path until equivalent acceptance passes. Preserve original public contracts, tests and assignment files. No external publication or submission is authorized. + +Use a separate single-server k3d cluster per lab on the test host, with an explicit private kubeconfig and context. Kubernetes resources and Pingap TOML live in git; generated synthetic credentials remain outside git and enter Kubernetes Secrets through stdin. This is a disposable coursework stand, not a multi-host HA cluster. No changes to the azur-games cluster are required. + +Pingap is a Deployment behind a LoadBalancer Service. API uses a headless Service, DNS discovery and readiness. PostgreSQL, Valkey and lab4 RustFS use PVCs and private Services. Migrations and S3 bootstrap are bounded Jobs. User data stays outside API pods. Local k3d uses the already installed k3s image; image digests are pinned. + +## Acceptance cases before implementation + +| Situation | Example | Expected result | Level | +| --- | --- | --- | --- | +| Wrong target | foreign cluster/context, missing receipt, malformed name | reject before mutation | helper unit | +| Startup | new isolated cluster and empty volumes | migrations, dependencies, API and Pingap ready | integration | +| Discovery | two API pods, scale 1/2/4 | distinct real pod IDs, DNS updates | HTTP integration | +| API failure | delete the actual serving pod | surviving API serves within public test deadline, no duplicates | e2e | +| Rolling replacement | restart API Deployment during writes | readiness, continuing writes, measured errors | e2e | +| Persistence | restart API, PostgreSQL, Valkey, Pingap and S3 | old session, messages and original bytes survive | e2e | +| Private S3 | anonymous object read, unrelated bucket creation | denied | integration | +| Partial upload | S3 or SQL error after write | existing reconciliation guarantees preserved | isolated integration | +| Resource limits | fixed and growing API budget, pool ABBA | verify actual requests/limits and collect new measurements | experiment | +| Memory | ten uploads and extreme PNG decoder | bounded rejection and measured memory | experiment | + +Failures include unavailable DNS/API/store, wrong namespace, unclaimed cluster, failed Jobs, stale readiness, rollout timeout and cleanup failure. Never turn a failed inventory read into permission to create or remove a cluster. Existing HAProxy evidence remains explicitly historical and is not relabeled as Pingap evidence. + +## Progress + +- [x] Runtime and guarded operational helpers; native image inventory, scoped stdin, Pod UID ownership and cleanup guards verified. +- [x] Equivalent public and student acceptance for lab3 and lab4. Smoke, full persistence, both failover scenarios and lab4 isolated reconciliation passed. Final HTTP acceptance passed409/457 assertions; SQL stdin and replaced original Pod UIDs verified. +- [x] New measurements and reports:16 lab3 samples plus a30-second rollout, ten concurrent image uploads and the extreme PNG/Adam7 memory Job. Game guards returned exactly1. Historical Compose numbers stay separate. +- [x] Independent runtime review and verified source sync:89 lab3 and115 lab4 source files match the remote checked copy. +- [x] Final native source and reports prepared for clean local commits and archive generation. CRC and complete byte-equality receipts are maintained separately in the parent DELIVERY.json. + +Independent read-only runtime/model/experiment-helper review found no remaining confirmed P1/P2. All84 unit cases and read-only Biome formatting/lint passed. Checked native source hashes are retained with the evidence. Independent review also verified the new measurements/report, including the negative pool result and the41.04% p95 reduction at4→2 API with equal total limits. diff --git a/evidence/REVIEW.md b/evidence/REVIEW.md new file mode 100644 index 00000000..fd587212 --- /dev/null +++ b/evidence/REVIEW.md @@ -0,0 +1,16 @@ +# Closure review: VP laboratories 2–4 + +Проверено независимым агентом 12.11.2026. Объём — закрытие ранее найденных P1/P2 в текущих исходниках и operational helpers; полного повторного аудита не проводилось. + +**Подтверждённых оставшихся ошибок в проверенном объёме не обнаружено.** + +- Compose wrappers закрепляют файл и проект через явные `-f`/`-p`; research lab3 и reconciliation используют отдельные случайные проекты. +- Reconciliation runner создаёт отдельные volumes, а destructive integration дополнительно требует пустые DB/bucket. Штатный профиль включает reconciliation, S3 metadata и foreign-membership regression. +- Fixture cleanup проверяет чужое членство и подтверждает SQL COMMIT до удаления S3-оригиналов. Отказ SQL сохраняет байты. +- Game guards разрешают измерения только при exit status `1`; активная игра и неизвестное состояние блокируют запуск. +- Evidence сохраняется в отдельных каталогах запуска; итоговый PASS появляется после cleanup. Основная ошибка и ошибки уборки учитываются отдельно. +- Monitor имеет немедленный rejection handler и завершается до cleanup. Rolling workload joined при отказе; замены проверяют readiness, продолжающиеся успешные записи и незавершённость нагрузки. +- JSON middleware отвергает некорректный UTF-8 до декодирования; regression присутствует во всех трёх лабораторных. +- В прочитанных acceptance2/3 уже используются `$fixture$` и PASS после cleanup. Их новое выполнение в это ревью не входило. + +Проверка выполнена чтением кода, текущего плана и diff. Стенды, тесты, сборки и измерительные helpers не запускались; результаты автора повторно не подтверждались. Секреты и `.local` не читались. Единственное изменение ревьюера — этот файл. diff --git a/evidence/SOURCE.sha256 b/evidence/SOURCE.sha256 new file mode 100644 index 00000000..d4fdb5b9 --- /dev/null +++ b/evidence/SOURCE.sha256 @@ -0,0 +1,89 @@ +14b7f3ced177639c80c8c9b113bef7d4783940b628f14d8bb6fc634eaa3d19e0 .dockerignore +a45d7932ef14130aff8020bce79f043cccaf9692d697088a754d309a03f7d3e8 .github/workflows/contracts.yml +b85d1e62d1f6d9c478cd1ce31c123c31c09a9c8b0565cf236f39a928a20a640b .gitignore +314ecc42f648282ee0f8b758027f3bf8c1860679e388a1574ed88b07b70c400b Dockerfile +c05bd07058ae0949dd4905afdae7674bc7e3e63863a6cdf8b72661140d445826 Makefile +215578dee14bcef1b66759a68543083e0a624611efcdb785197307b50cb7725d backend/.golangci.yaml +d2a2661065473760696623b2bdfb93313c668f19130993c880bccf26d17c6912 backend/cmd/app/main.go +90459ce1de93d68af72228f24601279d33fe2384bebe5ada57a5bd15b28dd7dd backend/codegen.yaml +33044d905354f24fff194fefd35ee9327d63d6e5062ded8496e518b6ce38dbea backend/db/migrate.go +057db27dac8043c3142c9530f2e699f312161813dfe829f043915ee7c7e0f08e backend/db/migrations/00001_core.sql +97c98785547db8391c1fa0a685e4d4bcc810b8f79055c0e2fc6ef473cd38b37b backend/db/migrations/00002_idempotency.sql +bd945de5a2ad6d762e959888be4907d0927df524d535c9b5f4a80672f9e921fb backend/db/sqlc/queries/core.sql +391f1ff0f354471949037426935a12e77024467236b69012e9c4f733ed3aa606 backend/db/sqlc/queries/idempotency.sql +803b161e063692398c93152b11a08f9e42e1bf3c72a1e64553b82c494545fd10 backend/db/sqlc/sqlc.yaml +62e951c7ddec4b5d1a4b643522ac4ecc25baba71ac71c8d3c3c65c9fd5bb47f5 backend/go.mod +c80befc84323b33479f9ea9116d68ab1e3874597642ce0359c9dfe4733a568d9 backend/go.sum +3508f04c2fbab10a346e1bb70574875ec39d4e45e7fa637299b65477ea439efe backend/internal/adapter/handler/api.gen.go +1e1e911d81ed2ca7703923909aae1362adceb0a39cb5be1105fb8cd60f03a974 backend/internal/adapter/handler/api.go +183217c9d66dcfb08d3da92fda01df509484bd3146b36587d84e37fbda5f3b4b backend/internal/adapter/handler/auth.go +343035190d2e13beaeafd904a54e6f62226dc7d92bd6ae78c1b8bd39d42f60b0 backend/internal/adapter/handler/errors.go +b662058ebc59010f30d21da12404837aa2329fe5e5590761efdd9140c1d24e9c backend/internal/adapter/handler/gate.go +f7938bdeb5617ed3611303c54818000de9861dde5915fa2c6fa0f74e1fa33268 backend/internal/adapter/handler/gate_test.go +f1961eebd1c3b21cdcf4af67be7882da47c85aaba969cc0d8eca73844a26a342 backend/internal/adapter/handler/handler.go +964aee4c74d75f1249d2e15d10a4fcbfe0b8b7e4a02a41474911d12ec163bd0c backend/internal/adapter/handler/json.go +22ea82d94edd6272c6c1c2a221b999f29d6f58a4946877470be03342f9073e36 backend/internal/adapter/handler/middleware.go +5cd375e5a0db8cc3596293d323e635b86fef22d8ec680f310ab5a460f8176f64 backend/internal/adapter/handler/stats.go +eac6a14b5f3b0ea9aa5329337afc6db27e17f5c17999874da9ce3592dc7a4205 backend/internal/adapter/handler/utf8_test.go +94643bf4b61ca390f8dd56a241e02e1325a994fc40887ffa0e2b8f8e5aebb4c7 backend/internal/adapter/password/argon.go +513a218e594616b5c594cca27bf1652d5321b0d567402303e1e103a19bbb63d8 backend/internal/adapter/repository/postgres/queries/core.sql.go +4863732830879d4162be215ff245375b953359de23bcd821ed7abc5c32a36c0f backend/internal/adapter/repository/postgres/queries/db.go +d231780de17bb3d5ca1a769eb817d7c555d576fa815c5245a0ec6ee90c3f28ce backend/internal/adapter/repository/postgres/queries/idempotency.sql.go +c0db6538d3509079b15218e6493652be501841a7d5560454754dbff6a2789c51 backend/internal/adapter/repository/postgres/queries/models.go +bd70d2954ed260b96d3b9200b56dbbf96dea0d985eec336aa690ff860b766857 backend/internal/adapter/repository/postgres/repository.go +93802954db2c8eda3782acc71bca817947fd556986d3f6552c78c4b346d988ca backend/internal/application/usecase/auth.go +5e999c10089bd5148f8e5a897c38cd1c3299ebd5bd598a6f58bd168d8e51cc96 backend/internal/application/usecase/messenger.go +58795b18980c4dd938c73721ab937d06410af94edc156b7a7aa9b2c4c2388238 backend/internal/config/config.go +390e3b5a4682719a0b25a8eb9aefeda9a9d1c774d3f8d1f08062c79a58d8859a backend/internal/config/config_test.go +3f7454f48ef442c277fd2741ce5aeeccf03d590bd2d31b9b89fa39f0ba05de7f backend/internal/domain/model/chat.go +bd55666ad90ecaba3b0a1496ba5499580c0c67446284ce0b83e4dd7633cecbae backend/internal/domain/model/errors.go +f129b9822b9136bed8c0e02d96437e3c5085eda69847ade2ffcb1f82697121f4 backend/internal/domain/model/message.go +77bb8767ac1352bd3551e724eaaeaad4fe93eae248cc8c3008ee8b1c08adddca backend/internal/domain/model/model_test.go +cd6a07579bff01aa0d8a11b34fd000a804142b321cef302d386bdb95e9c7f953 backend/internal/domain/model/page.go +8c245eef99a97261daf0aa16fec9edd7bcd3253ec4144c50b4f8e56e45e2186e backend/internal/domain/model/postgres_text_test.go +c9410cacd9d1b2fd7f3f2cb7e4112e637ecc494f6e4b6da649f936ce0c9a0457 backend/internal/domain/model/text.go +c20c8b8d8a9c0327a3a24afd74f3051d78caed1d2f0851baf340ef61ac502a92 backend/internal/domain/model/user.go +465c1a1f19075b6f8301eef8dbd7fd9a8d20255716d72c97e946db04c2850dda backend/internal/domain/port/auth.go +4402ef91f87910199103f059b654d362106059a4f0ee89e9cadfe7e6d49fa0ee backend/internal/domain/repository/repository.go +d839f31015eee692065c31d2538a4cb4c841b0d89e690f0ab8baf80168510556 backend/pkg/logger/logger.go +3ce957e4e45a94453610217007a9dbf0e8b9723346ff9cc8a3e5aa8ff3676527 backend/pkg/server/server.go +41522570e101e67a4889e9bfd290027f363831781d4ce401874d771ec116fef6 compose.example.yaml +fc7ee75e5625d673dd9f72df9b67788353affb15384734243cb85ee72ce1cd8d compose.yaml +9aa30d231d71b762dbd8f5e42a8d19a6cabe3375f0fdf26bc5843b965dfa947b config/haproxy.cfg +0a71cec72903af556df85f939c7e347fc73a86a1a4ffc39fb9c8ded169b7df45 contracts/examples.json +99320becab20381c3d31983336dd4e0aef4bca992d672538f049b6684714a577 contracts/infrastructure.json +9c3787e5d08a60c59ae67eeb429e9d75fbf134992a4e1f0954e926db49e111be contracts/openapi.json +b83ce35e84323244b9d22e175d9c4c0f25c9a1ce1f932c36ecf30f0ba8dddad9 deploy/k3s/api.yaml +3c9479510ac6116d196fab0f3116a3145ef2377a8e04b7f936994c18113c69a9 deploy/k3s/kustomization.yaml +e1d475e64e0092e5c92c6ace235c70b92cd2b42b83a420e2edf880a3fb50b8b8 deploy/k3s/namespace.yaml +e436503ba6893e1f5fe0f1819471d5be2612d07b66790277293ef7e4ed7041d6 deploy/k3s/pingap.toml +2542ef86087c55961f8d66ac70f8d9f616211b95d67d44e9fba8a4d700e53e16 deploy/k3s/pingap.yaml +6dff977e5f1541e4713967844474a43c2150117a3ea666f737c788b6e7c234ee deploy/k3s/stores.yaml +bddb95ebba97431ee956256e677b0724485d571d54438aca07d54df72227098d examples/requests.http +acf873f5132bbd0af78dc878852baeb49dbfa026c072932f8bd70b958114e938 lab.json +4cefdb67007caf026d1613be7c519c01b4c8343db7c4f4b618677e01cf113525 requirements-dev.txt +01ea196f3a6db22c501209d7496bc774b4b04687fd5f30850acd863545852466 scripts/bootstrap.ts +7c4402c2a6ab80d3b4676e1866d6ecc87b6daea14c080bcb9be9a7e8b959d671 scripts/check_contract.py +a25717fd601ee8359a0c4b58f3f7e10f38dfcf875b96ed8707c314ceadc9e41e scripts/compose.sh +35a7507a45f2672095ae7a31a2e347421f16a81e78a76ccd4bf2c8e149dddb14 scripts/k3s-model.ts +4951d81ca55099c7459106392bccc72fdaeeb090bc85bc38e01b42425bbba77d scripts/k3s.ts +f9eaabbb88f14a49fdd8bd09de18de6959eefae9fb935a661afc0d500ef47a8c scripts/kube.sh +0328246ba75defbced992104e986fde973f63e3830d83251eced5953263e944b scripts/restart.example.sh +76af791797a37549b64446687484eab58c3825926a0fee9bc6d1375cdf024b07 scripts/restart.sh +1bcf34394520b89d95b7605ec56675be799eea920e83cfbba306d5dc0a6d9811 scripts/stop-one.example.sh +623ec85f2918c814dd7c12de14fe06c89bd9277afb60b431e59356aa45e6c876 scripts/stop-one.sh +63b69b19641e8f9e27a9b159bf8c67c612e3476193c17e93541ca6cfd48ff2fd scripts/up.sh +4e981acbfc10dac58817bf922d5896e996798551fedc1b2385130e1cddb13d54 scripts/validate_openapi.py +b77f4aa20f58ca84f0be5c3e3d83d9f84e6fd85eabf0992f33c7918c2bfdde74 student-tests/acceptance.ts +4693f4d130bdaa88fe5d61258b55f56844c7d67ee72b819ef4997b80d852cb95 student-tests/k3s-model.test.ts +41849faeeb5ea371eb56f0dc500f658ab46d142451727816501bb134b4b6e31e student-tests/kube-stdin.ts +1a69e392a1b0fc28869cc45c564225fe5e8cb8a784cf0a6ac1cbf3335c521205 student-tests/plot_research.py +de950d3b75e4ad1a760c121533e06390c84574f7dd0b53c0eaa742ab6d5c2f38 student-tests/requirements-plots.txt +2baadbdff936f4606a759cbfbae972eb2043e43e2081873d03f508b9bb7fd111 student-tests/research-compose.ts +daad32606eda2d00405881b1d04147e369ec4926e36191906d3a23d5bd36adbf student-tests/research.ts +7de6e4f405cb165f56e48f40889adc5ff39c9a8ec253de48e5633a0d961d960a student-tests/restart-evidence.ts +9dff91ee5a9876d5c4758d66a65b3b42c29a6d3071c7e510babae561a84cf35b student-tests/wait.ts +8d50976fc7c7bbb81e88a152f613c61ab25eaf53dba33c6a9dfab19f868d546d tests/client.py +6d3511ea719c7a7e841083e73d435c86dcbfd9f4e5c2a07d62eb9614b01d9933 tests/load.py +1f96663a174b3978d24eff66f2741f5f8c9b788d3242261d37a972720c52788b tests/resilience.py +52ac38eb343ff7d43e7543588e1da58ca06c9fce74b2b0d0bf0e4982bc23c1db tests/smoke.py diff --git a/evidence/acceptance.txt b/evidence/acceptance.txt new file mode 100644 index 00000000..913911a8 --- /dev/null +++ b/evidence/acceptance.txt @@ -0,0 +1 @@ +PASS lab3: 408 HTTP assertions, registration race, rollback, pagination, authentication, concurrent idempotency and replica sharing; fixture cleanup completed diff --git a/evidence/build.txt b/evidence/build.txt new file mode 100644 index 00000000..a754683c --- /dev/null +++ b/evidence/build.txt @@ -0,0 +1,131 @@ +#1 [internal] load local bake definitions +#1 reading from stdin 1.04kB done +#1 DONE 0.0s + +#2 [migrate internal] load build definition from Dockerfile +#2 transferring dockerfile: 1.78kB 0.0s done +#2 DONE 0.1s + +#3 [api] resolve image config for docker-image://docker.io/docker/dockerfile:1 +#3 DONE 1.0s + +#4 [api] docker-image://docker.io/docker/dockerfile:1@sha256:4edf897a3ffa55b89f906fc8cc78afdb3f1834cc9c7083565e611a8a7d5fe99e +#4 resolve docker.io/docker/dockerfile:1@sha256:4edf897a3ffa55b89f906fc8cc78afdb3f1834cc9c7083565e611a8a7d5fe99e +#4 resolve docker.io/docker/dockerfile:1@sha256:4edf897a3ffa55b89f906fc8cc78afdb3f1834cc9c7083565e611a8a7d5fe99e 0.3s done +#4 resolve docker.io/docker/dockerfile:1@sha256:4edf897a3ffa55b89f906fc8cc78afdb3f1834cc9c7083565e611a8a7d5fe99e 0.3s done +#4 CACHED + +#5 [api internal] load metadata for gcr.io/distroless/static-debian13:nonroot@sha256:e2e927ec666bae08560abb3c55d0659eceabb657f56b6782ab500a9fc7f555e3 +#5 ... + +#6 [api internal] load metadata for docker.io/library/golang:1.27.2-alpine@sha256:f92b6ef800e499660581efdabdf25d9d817a9d124eaf900924f0504e7e27e12d +#6 DONE 0.4s + +#5 [migrate internal] load metadata for gcr.io/distroless/static-debian13:nonroot@sha256:e2e927ec666bae08560abb3c55d0659eceabb657f56b6782ab500a9fc7f555e3 +#5 DONE 31.2s + +#7 [api internal] load .dockerignore +#7 transferring context: 226B 0.0s done +#7 DONE 0.1s + +#8 [api internal] load build context +#8 DONE 0.0s + +#9 [api stage-1 1/2] FROM gcr.io/distroless/static-debian13:nonroot@sha256:e2e927ec666bae08560abb3c55d0659eceabb657f56b6782ab500a9fc7f555e3 +#9 resolve gcr.io/distroless/static-debian13:nonroot@sha256:e2e927ec666bae08560abb3c55d0659eceabb657f56b6782ab500a9fc7f555e3 +#9 ... + +#8 [migrate internal] load build context +#8 DONE 0.0s + +#9 [migrate stage-1 1/2] FROM gcr.io/distroless/static-debian13:nonroot@sha256:e2e927ec666bae08560abb3c55d0659eceabb657f56b6782ab500a9fc7f555e3 +#9 ... + +#10 [api build 1/4] FROM docker.io/library/golang:1.27.2-alpine@sha256:f92b6ef800e499660581efdabdf25d9d817a9d124eaf900924f0504e7e27e12d +#10 resolve docker.io/library/golang:1.27.2-alpine@sha256:f92b6ef800e499660581efdabdf25d9d817a9d124eaf900924f0504e7e27e12d 0.4s done +#10 DONE 0.6s + +#8 [api internal] load build context +#8 ... + +#9 [migrate stage-1 1/2] FROM gcr.io/distroless/static-debian13:nonroot@sha256:e2e927ec666bae08560abb3c55d0659eceabb657f56b6782ab500a9fc7f555e3 +#9 resolve gcr.io/distroless/static-debian13:nonroot@sha256:e2e927ec666bae08560abb3c55d0659eceabb657f56b6782ab500a9fc7f555e3 0.8s done +#9 DONE 0.9s + +#8 [migrate internal] load build context +#8 transferring context: 131.27kB 0.2s done +#8 DONE 0.4s + +#11 [api build 2/4] WORKDIR /src +#11 CACHED + +#12 [api build 3/4] COPY backend/ ./ +#12 DONE 0.9s + +#13 [migrate build 4/4] RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build go build -trimpath -ldflags='-s -w' -o /out/messenger ./cmd/app +#13 DONE 5.5s + +#9 [api stage-1 1/2] FROM gcr.io/distroless/static-debian13:nonroot@sha256:e2e927ec666bae08560abb3c55d0659eceabb657f56b6782ab500a9fc7f555e3 +#9 CACHED + +#14 [api stage-1 2/2] COPY --from=build /out/messenger /messenger +#14 DONE 0.9s + +#15 [api] exporting to image +#15 exporting layers +#15 exporting layers 1.4s done +#15 exporting manifest sha256:15b116d2b7ca5f2bb46513f70348161a0ad4efa6e57d1fbe5c994c7e2a19d68e +#15 exporting manifest sha256:15b116d2b7ca5f2bb46513f70348161a0ad4efa6e57d1fbe5c994c7e2a19d68e 0.5s done +#15 exporting config sha256:4b32867dcf2a904b9f1e0d29badb554945a643fc8b901f7d60eac9d81d5b5ced +#15 exporting config sha256:4b32867dcf2a904b9f1e0d29badb554945a643fc8b901f7d60eac9d81d5b5ced 0.5s done +#15 exporting attestation manifest sha256:36d1d100f23547fb93e2309f401b5c3d9fa182ebdba8172d59f654ca7aa15128 +#15 exporting attestation manifest sha256:36d1d100f23547fb93e2309f401b5c3d9fa182ebdba8172d59f654ca7aa15128 0.7s done +#15 exporting manifest list sha256:7369359f8b08120b4fd2362f1ecf9dccfbf29f16368c09276784885821d60435 +#15 exporting manifest list sha256:7369359f8b08120b4fd2362f1ecf9dccfbf29f16368c09276784885821d60435 0.3s done +#15 naming to docker.io/library/vp-medvedev-lab3:local +#15 naming to docker.io/library/vp-medvedev-lab3:local 0.2s done +#15 unpacking to docker.io/library/vp-medvedev-lab3:local +#15 unpacking to docker.io/library/vp-medvedev-lab3:local 0.6s done +#15 DONE 4.8s + +#16 [migrate] exporting to image +#16 exporting layers 1.5s done +#16 exporting manifest sha256:0e735ec53a79c2cb5548e8bdb817740db6bbc2a61fd0c7e075b8f92eb42f8238 0.5s done +#16 exporting config sha256:f5c109fca6293d29084533cef4de6019a155cc684d5fdf0ec22d8aa27cd52e65 0.9s done +#16 exporting attestation manifest sha256:cb41ed80e30febbf0628a2ee0a137696fb271e0819a88a58881d39f23c90f315 0.5s done +#16 exporting manifest list sha256:690d1703ce0e0b391479b6006853144d1a895e58bc2d7490c5dca31a0bf67916 0.4s done +#16 naming to docker.io/library/vp-medvedev-lab3:local 0.1s done +#16 unpacking to docker.io/library/vp-medvedev-lab3:local 0.4s done +#16 DONE 4.9s + +#17 [api] resolving provenance for metadata file +#17 DONE 0.0s + +#18 [migrate] resolving provenance for metadata file +#18 DONE 0.0s + Image vp-medvedev-lab3:local Building + Image vp-medvedev-lab3:local Building + Image vp-medvedev-lab3:local Built + Image vp-medvedev-lab3:local Built + Container vp-lab3-medvedev-valkey-1 Running + Container vp-lab3-medvedev-postgres-1 Running + Container vp-lab3-medvedev-migrate-1 Recreate + Container vp-lab3-medvedev-migrate-1 Recreated + Container vp-lab3-medvedev-api-2 Recreate + Container vp-lab3-medvedev-api-1 Recreate + Container vp-lab3-medvedev-api-1 Recreated + Container vp-lab3-medvedev-api-2 Recreated + Container vp-lab3-medvedev-lb-1 Recreate + Container vp-lab3-medvedev-lb-1 Recreated + Container vp-lab3-medvedev-postgres-1 Waiting + Container vp-lab3-medvedev-postgres-1 Healthy + Container vp-lab3-medvedev-migrate-1 Starting + Container vp-lab3-medvedev-migrate-1 Started + Container vp-lab3-medvedev-migrate-1 Waiting + Container vp-lab3-medvedev-migrate-1 Exited + Container vp-lab3-medvedev-api-1 Starting + Container vp-lab3-medvedev-api-1 Started + Container vp-lab3-medvedev-api-2 Starting + Container vp-lab3-medvedev-api-2 Started + Container vp-lab3-medvedev-lb-1 Starting + Container vp-lab3-medvedev-lb-1 Started diff --git a/evidence/check.txt b/evidence/check.txt new file mode 100644 index 00000000..8ec28445 --- /dev/null +++ b/evidence/check.txt @@ -0,0 +1,2 @@ +/mnt/data/home/bench-saves/vp-labs-vuIKezo9/lab3/.venv/bin/python scripts/check_contract.py +PASS: offline skeleton structure, local refs and Python syntax; application NOT tested. diff --git a/evidence/compose-check.txt b/evidence/compose-check.txt new file mode 100644 index 00000000..e69de29b diff --git a/evidence/failover-1.txt b/evidence/failover-1.txt new file mode 100644 index 00000000..6d2a4d7b --- /dev/null +++ b/evidence/failover-1.txt @@ -0,0 +1,4 @@ +python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:28203" +Executing explicit failover hook; hook output suppressed to avoid leaking secrets. +{"observed_instances_before": 2, "successful_writes": 128, "failed_attempts": 1, "first_recovery_seconds": 1.468} +PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence. diff --git a/evidence/failover-2.txt b/evidence/failover-2.txt new file mode 100644 index 00000000..bad82813 --- /dev/null +++ b/evidence/failover-2.txt @@ -0,0 +1,4 @@ +python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:28203" +Executing explicit failover hook; hook output suppressed to avoid leaking secrets. +{"observed_instances_before": 2, "successful_writes": 127, "failed_attempts": 1, "first_recovery_seconds": 1.484} +PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence. diff --git a/evidence/generate.txt b/evidence/generate.txt new file mode 100644 index 00000000..e69de29b diff --git a/evidence/go-tests.txt b/evidence/go-tests.txt new file mode 100644 index 00000000..20a0b8a1 --- /dev/null +++ b/evidence/go-tests.txt @@ -0,0 +1,13 @@ +? backend/cmd/app [no test files] +? backend/db [no test files] +ok backend/internal/adapter/handler 1.040s +? backend/internal/adapter/password [no test files] +? backend/internal/adapter/repository/postgres [no test files] +? backend/internal/adapter/repository/postgres/queries [no test files] +? backend/internal/application/usecase [no test files] +ok backend/internal/config 1.018s +ok backend/internal/domain/model 1.014s +? backend/internal/domain/port [no test files] +? backend/internal/domain/repository [no test files] +? backend/pkg/logger [no test files] +? backend/pkg/server [no test files] diff --git a/evidence/k3s/REVIEW.md b/evidence/k3s/REVIEW.md new file mode 100644 index 00000000..e6fbcd4f --- /dev/null +++ b/evidence/k3s/REVIEW.md @@ -0,0 +1,15 @@ +# Independent runtime review + +Scope: approved lab3/lab4 k3s + Pingap migration, scripts/k3s.ts, scripts/k3s-model.ts, new unit tests and native research/concurrent-images/reconciliation call sites. Reviewer: independent agent /root/lab1_review, read-only. Backend and original course contracts were outside the implementation diff. + +No confirmed remaining P1/P2 findings in the reviewed scope. Confirmed prior findings were corrected: Pingap shutdown grace, pinned manifest/config identities, scoped kubectl arguments, game guard at the native memory Job, partial-claim ownership and native CRI verification of stopped Pod processes. + +Closure review checked withCleanup preserving primary and teardown errors, ready waiting for managed terminating Pods, restart pairing evidence by run_id and rejecting reused original UIDs, and the lab4 hard2048MiB/soft1536MiB image budget. Runtime/model copies in both labs matched. Reviewer ran no live operations or tests; author test output is separate. + +Live tests are author evidence, separate from read-only review. Archive validation, teacher acceptance and an awarded grade are not inferred from this review. + +Follow-up review checked the lab4 outage test timeout: no assignment/contract/public test requires8seconds for upload dependency failure. The handler budgets20seconds and the student client now waits at most25seconds, still requiring HTTP502/503 and a complete response. Public failover deadlines remain unchanged. Both acceptance helpers annotate their current operation and preserve the original error as cause. No blocker found; reviewer performed no live test. + +Final measurement/report review checked all16 samples in research/run-R4F28Q, rolling/replacement evidence, plots and ChargeMessage SQL. Means, ranges, errors, memory and PostgreSQL observations agree with REPORT.md. Both two-API p95 results are below both four-API results at equal total budget; mean reduction41.04%. The negative pool experiment and overlapping throughput ranges are reported explicitly. Rolling2725success/0errors replaced both original UIDs. No material blocker found. A minor wording issue was corrected: scaling.svg displays ranges; pool.svg displays means only. No remote operations or test reruns were performed by the reviewer. + +The earlier JSON-aggregate parse failure was captured as RED. The runner now emits jsonb::text and preserves failureStage before cleanup; the complete native study is its successful boundary check. diff --git a/evidence/k3s/acceptance.txt b/evidence/k3s/acceptance.txt new file mode 100644 index 00000000..faec4e58 --- /dev/null +++ b/evidence/k3s/acceptance.txt @@ -0,0 +1,2 @@ +Running as unit: run-p1580581-i1556111.scope; invocation ID: fe2791c13cde49c083165d2cbfdecc25 +PASS lab3: 409 HTTP assertions, registration race, rollback, pagination, authentication, concurrent idempotency and replica sharing; fixture cleanup completed diff --git a/evidence/k3s/contracts.txt b/evidence/k3s/contracts.txt new file mode 100644 index 00000000..ed9cd475 --- /dev/null +++ b/evidence/k3s/contracts.txt @@ -0,0 +1,4 @@ +.venv/bin/python scripts/check_contract.py +PASS: offline skeleton structure, local refs and Python syntax; application NOT tested. +.venv/bin/python scripts/validate_openapi.py +PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested. diff --git a/evidence/k3s/failover-1.txt b/evidence/k3s/failover-1.txt new file mode 100644 index 00000000..c9a6909f --- /dev/null +++ b/evidence/k3s/failover-1.txt @@ -0,0 +1,4 @@ +python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:28203" +Executing explicit failover hook; hook output suppressed to avoid leaking secrets. +{"observed_instances_before": 2, "successful_writes": 79, "failed_attempts": 34, "first_recovery_seconds": 1.491} +PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence. diff --git a/evidence/k3s/failover-2.txt b/evidence/k3s/failover-2.txt new file mode 100644 index 00000000..f2f769b0 --- /dev/null +++ b/evidence/k3s/failover-2.txt @@ -0,0 +1,4 @@ +python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:28203" +Executing explicit failover hook; hook output suppressed to avoid leaking secrets. +{"observed_instances_before": 2, "successful_writes": 89, "failed_attempts": 36, "first_recovery_seconds": 1.649} +PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence. diff --git a/evidence/k3s/failover-native-final.txt b/evidence/k3s/failover-native-final.txt new file mode 100644 index 00000000..a87f1422 --- /dev/null +++ b/evidence/k3s/failover-native-final.txt @@ -0,0 +1,5 @@ +Running as unit: run-p1577904-i1587070.scope; invocation ID: a976c46b972045998b6eeb2aff8218cb +python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:28203" +Executing explicit failover hook; hook output suppressed to avoid leaking secrets. +{"observed_instances_before": 2, "successful_writes": 132, "failed_attempts": 1, "first_recovery_seconds": 1.478} +PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence. diff --git a/evidence/k3s/persistence.txt b/evidence/k3s/persistence.txt new file mode 100644 index 00000000..4f0d48de --- /dev/null +++ b/evidence/k3s/persistence.txt @@ -0,0 +1,3 @@ +python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://127.0.0.1:28203" +Executing explicit persistence hook; hook output suppressed to avoid leaking secrets. +PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence. diff --git a/evidence/k3s/research-json-red.json b/evidence/k3s/research-json-red.json new file mode 100644 index 00000000..173a052e --- /dev/null +++ b/evidence/k3s/research-json-red.json @@ -0,0 +1 @@ +{"stage":"stand_destroy","primary":"JSON Parse error: Unexpected EOF","cleanup_errors":[]} diff --git a/evidence/k3s/research/run-R4F28Q/fixed-1-8-1.json b/evidence/k3s/research/run-R4F28Q/fixed-1-8-1.json new file mode 100644 index 00000000..6bc222ae --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/fixed-1-8-1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.143, + "concurrency": 16, + "successful_requests": 604, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 117.433, + "successful_latency_ms": { + "p50": 133.477, + "p95": 175.258, + "p99": 200.33 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/k3s/research/run-R4F28Q/fixed-1-8-2.json b/evidence/k3s/research/run-R4F28Q/fixed-1-8-2.json new file mode 100644 index 00000000..d2a60bdb --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/fixed-1-8-2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.168, + "concurrency": 16, + "successful_requests": 603, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 116.672, + "successful_latency_ms": { + "p50": 133.488, + "p95": 175.326, + "p99": 208.589 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/k3s/research/run-R4F28Q/fixed-2-8-1.json b/evidence/k3s/research/run-R4F28Q/fixed-2-8-1.json new file mode 100644 index 00000000..48f83d98 --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/fixed-2-8-1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.161, + "concurrency": 16, + "successful_requests": 602, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 116.648, + "successful_latency_ms": { + "p50": 133.599, + "p95": 267.099, + "p99": 342.13 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/k3s/research/run-R4F28Q/fixed-2-8-2.json b/evidence/k3s/research/run-R4F28Q/fixed-2-8-2.json new file mode 100644 index 00000000..52031131 --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/fixed-2-8-2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.145, + "concurrency": 16, + "successful_requests": 588, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 114.289, + "successful_latency_ms": { + "p50": 133.497, + "p95": 283.707, + "p99": 385.774 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/k3s/research/run-R4F28Q/fixed-4-8-1.json b/evidence/k3s/research/run-R4F28Q/fixed-4-8-1.json new file mode 100644 index 00000000..e4bbc008 --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/fixed-4-8-1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.148, + "concurrency": 16, + "successful_requests": 398, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 77.308, + "successful_latency_ms": { + "p50": 141.704, + "p95": 592.047, + "p99": 1542.862 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/k3s/research/run-R4F28Q/fixed-4-8-2.json b/evidence/k3s/research/run-R4F28Q/fixed-4-8-2.json new file mode 100644 index 00000000..2a297fd6 --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/fixed-4-8-2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.15, + "concurrency": 16, + "successful_requests": 612, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 118.843, + "successful_latency_ms": { + "p50": 100.356, + "p95": 342.111, + "p99": 509.063 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/k3s/research/run-R4F28Q/growing-1-8-1.json b/evidence/k3s/research/run-R4F28Q/growing-1-8-1.json new file mode 100644 index 00000000..ff2da416 --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/growing-1-8-1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.14, + "concurrency": 16, + "successful_requests": 609, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 118.487, + "successful_latency_ms": { + "p50": 125.236, + "p95": 166.837, + "p99": 191.916 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/k3s/research/run-R4F28Q/growing-1-8-2.json b/evidence/k3s/research/run-R4F28Q/growing-1-8-2.json new file mode 100644 index 00000000..50549c5e --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/growing-1-8-2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.141, + "concurrency": 16, + "successful_requests": 592, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 115.144, + "successful_latency_ms": { + "p50": 133.487, + "p95": 175.153, + "p99": 209.005 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/k3s/research/run-R4F28Q/growing-2-8-1.json b/evidence/k3s/research/run-R4F28Q/growing-2-8-1.json new file mode 100644 index 00000000..c6a9e676 --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/growing-2-8-1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.141, + "concurrency": 16, + "successful_requests": 602, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 117.087, + "successful_latency_ms": { + "p50": 133.446, + "p95": 242.025, + "p99": 300.401 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/k3s/research/run-R4F28Q/growing-2-8-2.json b/evidence/k3s/research/run-R4F28Q/growing-2-8-2.json new file mode 100644 index 00000000..a0aa15d4 --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/growing-2-8-2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.206, + "concurrency": 16, + "successful_requests": 483, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 92.784, + "successful_latency_ms": { + "p50": 150.206, + "p95": 416.852, + "p99": 758.495 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/k3s/research/run-R4F28Q/growing-4-8-1.json b/evidence/k3s/research/run-R4F28Q/growing-4-8-1.json new file mode 100644 index 00000000..19b0b9ef --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/growing-4-8-1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.149, + "concurrency": 16, + "successful_requests": 587, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 113.996, + "successful_latency_ms": { + "p50": 108.526, + "p95": 341.859, + "p99": 509.083 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/k3s/research/run-R4F28Q/growing-4-8-2.json b/evidence/k3s/research/run-R4F28Q/growing-4-8-2.json new file mode 100644 index 00000000..688f55f5 --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/growing-4-8-2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.151, + "concurrency": 16, + "successful_requests": 609, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 118.235, + "successful_latency_ms": { + "p50": 108.462, + "p95": 333.75, + "p99": 458.974 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/k3s/research/run-R4F28Q/hardware.json b/evidence/k3s/research/run-R4F28Q/hardware.json new file mode 100644 index 00000000..e50ca53e --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/hardware.json @@ -0,0 +1,30 @@ +[ + { + "field": "CPU(s):", + "data": "16" + }, + { + "field": "On-line CPU(s) list:", + "data": "0-15" + }, + { + "field": "Model name:", + "data": "AMD Ryzen 7 5700X 8-Core Processor" + }, + { + "field": "Thread(s) per core:", + "data": "2" + }, + { + "field": "Core(s) per socket:", + "data": "8" + }, + { + "field": "CPU(s) scaling MHz:", + "data": "82%" + }, + { + "field": "NUMA node0 CPU(s):", + "data": "0-15" + } +] diff --git a/evidence/k3s/research/run-R4F28Q/pool-1-1-2.json b/evidence/k3s/research/run-R4F28Q/pool-1-1-2.json new file mode 100644 index 00000000..58f54504 --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/pool-1-1-2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.139, + "concurrency": 16, + "successful_requests": 598, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 116.366, + "successful_latency_ms": { + "p50": 133.437, + "p95": 166.377, + "p99": 216.771 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/k3s/research/run-R4F28Q/pool-1-1-3.json b/evidence/k3s/research/run-R4F28Q/pool-1-1-3.json new file mode 100644 index 00000000..196ac61c --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/pool-1-1-3.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.138, + "concurrency": 16, + "successful_requests": 565, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 109.975, + "successful_latency_ms": { + "p50": 133.462, + "p95": 208.454, + "p99": 341.772 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/k3s/research/run-R4F28Q/pool-1-8-1.json b/evidence/k3s/research/run-R4F28Q/pool-1-8-1.json new file mode 100644 index 00000000..591b4359 --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/pool-1-8-1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.141, + "concurrency": 16, + "successful_requests": 609, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 118.461, + "successful_latency_ms": { + "p50": 125.254, + "p95": 166.879, + "p99": 191.926 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/k3s/research/run-R4F28Q/pool-1-8-4.json b/evidence/k3s/research/run-R4F28Q/pool-1-8-4.json new file mode 100644 index 00000000..bdf514ad --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/pool-1-8-4.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.149, + "concurrency": 16, + "successful_requests": 596, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 115.747, + "successful_latency_ms": { + "p50": 133.393, + "p95": 183.591, + "p99": 258.514 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/k3s/research/run-R4F28Q/pool.svg b/evidence/k3s/research/run-R4F28Q/pool.svg new file mode 100644 index 00000000..4ab8fdf7 --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/pool.svg @@ -0,0 +1,361 @@ + + + + + + + + 2026-11-12T20:29:03.601037 + image/svg+xml + + + Matplotlib v3.11.2, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pool = 8 + + + + + + + + + + pool = 1 + + + + + + + + + + + + + + + 0 + + + + + + + + + + 20 + + + + + + + + + + 40 + + + + + + + + + + 60 + + + + + + + + + + 80 + + + + + + + + + + 100 + + + + + + + + + + 120 + + + + Successful req/s + + + + + + + + + + + + + + + + 117.10 + + + 113.17 + + + + + + + + + + + + + + + + + + + + + pool = 8 + + + + + + + + + + pool = 1 + + + + + + + + + + + + 0 + + + + + + + + + + 25 + + + + + + + + + + 50 + + + + + + + + + + 75 + + + + + + + + + + 100 + + + + + + + + + + 125 + + + + + + + + + + 150 + + + + + + + + + + 175 + + + + p95, ms + + + + + + + + + + + + + + + + 175.24 + + + 187.42 + + + + One hot sender; same single-replica CPU/RAM budget + + + + + + + + + + + diff --git a/evidence/k3s/research/run-R4F28Q/replacements.json b/evidence/k3s/research/run-R4F28Q/replacements.json new file mode 100644 index 00000000..ae1d9885 --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/replacements.json @@ -0,0 +1,28 @@ +{ + "before": [ + { + "name": "api-747c44bcb7-f5pd5", + "uid": "e3fe3bc8-e520-4849-8179-b2168d07233a" + }, + { + "name": "api-747c44bcb7-tb9tq", + "uid": "08ab5c19-1180-43c8-8993-108b40406e88" + } + ], + "after": [ + { + "name": "api-6d5996b6c6-5t8wf", + "uid": "abafbfe6-6e5e-4318-8322-8d0ef85ff1ae" + }, + { + "name": "api-6d5996b6c6-r72sd", + "uid": "ee081545-2161-4855-b485-ad132dac3570" + } + ], + "messages_before": 39, + "messages_after": 2028, + "strategy": { + "maxSurge": 1, + "maxUnavailable": 0 + } +} diff --git a/evidence/k3s/research/run-R4F28Q/rolling.json b/evidence/k3s/research/run-R4F28Q/rolling.json new file mode 100644 index 00000000..841152bd --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/rolling.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 30.0, + "elapsed_seconds": 30.073, + "concurrency": 8, + "successful_requests": 2725, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 90.612, + "successful_latency_ms": { + "p50": 58.545, + "p95": 219.169, + "p99": 566.767 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/k3s/research/run-R4F28Q/run.json b/evidence/k3s/research/run-R4F28Q/run.json new file mode 100644 index 00000000..50776ee9 --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/run.json @@ -0,0 +1 @@ +{"cluster":"vp-lab3-r-5c653044","started_at":"2026-11-12T17:19:55.908Z","state":"started"} diff --git a/evidence/k3s/research/run-R4F28Q/scaling.svg b/evidence/k3s/research/run-R4F28Q/scaling.svg new file mode 100644 index 00000000..4f158a08 --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/scaling.svg @@ -0,0 +1,695 @@ + + + + + + + + 2026-11-12T20:29:03.510827 + image/svg+xml + + + Matplotlib v3.11.2, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + 2 + + + + + + + + + + + + + 4 + + + + API replicas + + + + + + + + + + + + + + + + + 80 + + + + + + + + + + + + + 90 + + + + + + + + + + + + + 100 + + + + + + + + + + + + + 110 + + + + + + + + + + + + + 120 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Successful requests / second + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fixed total API CPU/RAM + + + + + + + + + + + + + + + + + + + + + + + + Resources grow with replicas + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + 2 + + + + + + + + + + + + + 4 + + + + API replicas + + + + + + + + + + + + + + 200 + + + + + + + + + + + + + 300 + + + + + + + + + + + + + 400 + + + + + + + + + + + + + 500 + + + + + + + + + + + + + 600 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + p95 of successful requests, ms + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fixed total API CPU/RAM + + + + + + + + + + + + + + + + + + + + + + + + Resources grow with replicas + + + + + Closed loop, concurrency 16, 5 seconds; mean and range of two runs + + + + + + + + + + + diff --git a/evidence/k3s/research/run-R4F28Q/summary.json b/evidence/k3s/research/run-R4F28Q/summary.json new file mode 100644 index 00000000..ac616ae4 --- /dev/null +++ b/evidence/k3s/research/run-R4F28Q/summary.json @@ -0,0 +1,3254 @@ +{ + "valid": true, + "complete": true, + "cluster": "vp-lab3-r-5c653044", + "runtime": "k3s1.37.1/Pingap0.16.0", + "expected_samples": 16, + "profile": "closed-loop POST text; concurrency16;5seconds;two repetitions;fresh data;single hot sender", + "samples": [ + { + "phase": "fixed", + "replicas": 1, + "repeat": 1, + "pool": 8, + "api_cpu_each": 2, + "api_memory_mb_each": 2048, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.143, + "concurrency": 16, + "successful_requests": 604, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 117.433, + "successful_latency_ms": { + "p50": 133.477, + "p95": 175.258, + "p99": 200.33 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": { + "at": "2026-11-12T17:22:53.694Z", + "pods": [ + { + "pod": "api-86f89bb65c-b29nf", + "uid": "e81b96e5-1c17-47f7-97d6-aaa24f8c6ddd", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 77082624, + "memory_peak_bytes": 79298560, + "cpu_usage_usec": 268994, + "limits": { + "cpu": "2", + "memory": "2Gi" + } + } + ] + }, + "postgres_wait_samples": [ + { + "at": "2026-11-12T17:22:52.587679+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:22:52.789031+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:22:52.991+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:22:53.193021+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:22:53.395051+00:00", + "events": [ + { + "count": 1, + "wait_event": "ClientRead", + "wait_event_type": "Client" + }, + { + "count": 2, + "wait_event": "transactionid", + "wait_event_type": "Lock" + }, + { + "count": 1, + "wait_event": null, + "wait_event_type": null + } + ] + }, + { + "at": "2026-11-12T17:22:53.59702+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:22:53.798977+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:22:54.000985+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:22:54.202938+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:22:54.404901+00:00", + "events": [ + { + "count": 2, + "wait_event": "transactionid", + "wait_event_type": "Lock" + }, + { + "count": 1, + "wait_event": null, + "wait_event_type": null + } + ] + } + ], + "messages": 604 + }, + { + "phase": "fixed", + "replicas": 1, + "repeat": 2, + "pool": 8, + "api_cpu_each": 2, + "api_memory_mb_each": 2048, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.168, + "concurrency": 16, + "successful_requests": 603, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 116.672, + "successful_latency_ms": { + "p50": 133.488, + "p95": 175.326, + "p99": 208.589 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": { + "at": "2026-11-12T17:22:59.925Z", + "pods": [ + { + "pod": "api-86f89bb65c-b29nf", + "uid": "e81b96e5-1c17-47f7-97d6-aaa24f8c6ddd", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 103673856, + "memory_peak_bytes": 104607744, + "cpu_usage_usec": 699009, + "limits": { + "cpu": "2", + "memory": "2Gi" + } + } + ] + }, + "postgres_wait_samples": [ + { + "at": "2026-11-12T17:22:58.826119+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:22:59.02846+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:22:59.230384+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:22:59.432252+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:22:59.634263+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:22:59.836139+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:00.038065+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:00.240066+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:00.442038+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:00.644029+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + } + ], + "messages": 603 + }, + { + "phase": "fixed", + "replicas": 2, + "repeat": 1, + "pool": 8, + "api_cpu_each": 1, + "api_memory_mb_each": 1024, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.161, + "concurrency": 16, + "successful_requests": 602, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 116.648, + "successful_latency_ms": { + "p50": 133.599, + "p95": 267.099, + "p99": 342.13 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": { + "at": "2026-11-12T17:23:29.261Z", + "pods": [ + { + "pod": "api-7d86b9fd46-bmz2v", + "uid": "348128af-7afd-4b19-8cf3-14daf916fb12", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 76828672, + "memory_peak_bytes": 78594048, + "cpu_usage_usec": 156593, + "limits": { + "cpu": "1", + "memory": "1Gi" + } + }, + { + "pod": "api-7d86b9fd46-ccvmb", + "uid": "7fe1d65e-5bdb-439e-b5bf-e46aacd12754", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 76754944, + "memory_peak_bytes": 78782464, + "cpu_usage_usec": 159318, + "limits": { + "cpu": "1", + "memory": "1Gi" + } + } + ] + }, + "postgres_wait_samples": [ + { + "at": "2026-11-12T17:23:27.998191+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:28.200356+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:28.402357+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 5, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:28.604376+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:28.806406+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:29.00841+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:29.210614+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:29.412616+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:29.614422+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 6, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:29.816431+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 6, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + } + ], + "messages": 602 + }, + { + "phase": "fixed", + "replicas": 2, + "repeat": 2, + "pool": 8, + "api_cpu_each": 1, + "api_memory_mb_each": 1024, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.145, + "concurrency": 16, + "successful_requests": 588, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 114.289, + "successful_latency_ms": { + "p50": 133.497, + "p95": 283.707, + "p99": 385.774 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": { + "at": "2026-11-12T17:23:35.669Z", + "pods": [ + { + "pod": "api-7d86b9fd46-bmz2v", + "uid": "348128af-7afd-4b19-8cf3-14daf916fb12", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 83300352, + "memory_peak_bytes": 85094400, + "cpu_usage_usec": 389647, + "limits": { + "cpu": "1", + "memory": "1Gi" + } + }, + { + "pod": "api-7d86b9fd46-ccvmb", + "uid": "7fe1d65e-5bdb-439e-b5bf-e46aacd12754", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 81588224, + "memory_peak_bytes": 83140608, + "cpu_usage_usec": 393053, + "limits": { + "cpu": "1", + "memory": "1Gi" + } + } + ] + }, + "postgres_wait_samples": [ + { + "at": "2026-11-12T17:23:34.394543+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:34.596882+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:34.798892+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:35.000878+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:35.202889+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 5, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:35.404806+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:35.606876+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:35.808927+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 6, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:36.010804+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalInitSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:23:36.212762+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + } + ], + "messages": 588 + }, + { + "phase": "fixed", + "replicas": 4, + "repeat": 1, + "pool": 8, + "api_cpu_each": 0.5, + "api_memory_mb_each": 512, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.148, + "concurrency": 16, + "successful_requests": 398, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 77.308, + "successful_latency_ms": { + "p50": 141.704, + "p95": 592.047, + "p99": 1542.862 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": { + "at": "2026-11-12T17:24:11.337Z", + "pods": [ + { + "pod": "api-6f875c4fbb-4hkxv", + "uid": "159d43a3-7363-4e18-96ca-aaa06ec0154d", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 76582912, + "memory_peak_bytes": 78864384, + "cpu_usage_usec": 101047, + "limits": { + "cpu": "500m", + "memory": "512Mi" + } + }, + { + "pod": "api-6f875c4fbb-bhtvs", + "uid": "2c4a4b07-13e4-4497-aeaa-8559d8ddca67", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 42491904, + "memory_peak_bytes": 44105728, + "cpu_usage_usec": 73223, + "limits": { + "cpu": "500m", + "memory": "512Mi" + } + }, + { + "pod": "api-6f875c4fbb-c7ll9", + "uid": "9b3e458b-5e88-4233-9ba8-996d4a0c3804", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 41738240, + "memory_peak_bytes": 45010944, + "cpu_usage_usec": 74130, + "limits": { + "cpu": "500m", + "memory": "512Mi" + } + }, + { + "pod": "api-6f875c4fbb-jkzx2", + "uid": "e800db4e-50a2-456c-ab91-dbd6cd4b040f", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 75796480, + "memory_peak_bytes": 78667776, + "cpu_usage_usec": 96658, + "limits": { + "cpu": "500m", + "memory": "512Mi" + } + } + ] + }, + "postgres_wait_samples": [ + { + "at": "2026-11-12T17:24:09.787818+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 12, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:09.990022+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 13, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:10.192034+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 13, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:10.394046+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 15, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:10.596112+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 13, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:10.798122+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 12, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:11.000314+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 12, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:11.20277+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 12, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:11.404844+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 11, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:11.606939+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 12, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + } + ], + "messages": 398 + }, + { + "phase": "fixed", + "replicas": 4, + "repeat": 2, + "pool": 8, + "api_cpu_each": 0.5, + "api_memory_mb_each": 512, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.15, + "concurrency": 16, + "successful_requests": 612, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 118.843, + "successful_latency_ms": { + "p50": 100.356, + "p95": 342.111, + "p99": 509.063 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": { + "at": "2026-11-12T17:24:17.984Z", + "pods": [ + { + "pod": "api-6f875c4fbb-4hkxv", + "uid": "159d43a3-7363-4e18-96ca-aaa06ec0154d", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 82771968, + "memory_peak_bytes": 89858048, + "cpu_usage_usec": 224527, + "limits": { + "cpu": "500m", + "memory": "512Mi" + } + }, + { + "pod": "api-6f875c4fbb-bhtvs", + "uid": "2c4a4b07-13e4-4497-aeaa-8559d8ddca67", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 78180352, + "memory_peak_bytes": 80494592, + "cpu_usage_usec": 165472, + "limits": { + "cpu": "500m", + "memory": "512Mi" + } + }, + { + "pod": "api-6f875c4fbb-c7ll9", + "uid": "9b3e458b-5e88-4233-9ba8-996d4a0c3804", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 76328960, + "memory_peak_bytes": 78303232, + "cpu_usage_usec": 169281, + "limits": { + "cpu": "500m", + "memory": "512Mi" + } + }, + { + "pod": "api-6f875c4fbb-jkzx2", + "uid": "e800db4e-50a2-456c-ab91-dbd6cd4b040f", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 83701760, + "memory_peak_bytes": 89317376, + "cpu_usage_usec": 223168, + "limits": { + "cpu": "500m", + "memory": "512Mi" + } + } + ] + }, + "postgres_wait_samples": [ + { + "at": "2026-11-12T17:24:16.40523+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 13, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:16.60746+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 11, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:16.809384+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 11, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:17.011304+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 11, + "wait_event": "transactionid", + "wait_event_type": "Lock" + }, + { + "count": 1, + "wait_event": null, + "wait_event_type": null + } + ] + }, + { + "at": "2026-11-12T17:24:17.213257+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 11, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:17.415192+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 13, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:17.617389+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 13, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:17.819466+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 13, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:18.02134+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 9, + "wait_event": "transactionid", + "wait_event_type": "Lock" + }, + { + "count": 1, + "wait_event": null, + "wait_event_type": null + } + ] + }, + { + "at": "2026-11-12T17:24:18.223299+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 14, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + } + ], + "messages": 612 + }, + { + "phase": "growing", + "replicas": 1, + "repeat": 1, + "pool": 8, + "api_cpu_each": 1, + "api_memory_mb_each": 512, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.14, + "concurrency": 16, + "successful_requests": 609, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 118.487, + "successful_latency_ms": { + "p50": 125.236, + "p95": 166.837, + "p99": 191.916 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": { + "at": "2026-11-12T17:24:41.973Z", + "pods": [ + { + "pod": "api-747c44bcb7-rvzfc", + "uid": "7501101b-8fa6-4093-84c1-3b2a449ff6e5", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 74940416, + "memory_peak_bytes": 77041664, + "cpu_usage_usec": 273242, + "limits": { + "cpu": "1", + "memory": "512Mi" + } + } + ] + }, + "postgres_wait_samples": [ + { + "at": "2026-11-12T17:24:40.853973+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:41.0562+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:41.258192+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:41.460196+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:41.662062+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:41.864143+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:42.066168+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:42.268143+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:42.470052+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:42.672099+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + } + ], + "messages": 609 + }, + { + "phase": "growing", + "replicas": 1, + "repeat": 2, + "pool": 8, + "api_cpu_each": 1, + "api_memory_mb_each": 512, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.141, + "concurrency": 16, + "successful_requests": 592, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 115.144, + "successful_latency_ms": { + "p50": 133.487, + "p95": 175.153, + "p99": 209.005 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": { + "at": "2026-11-12T17:24:48.207Z", + "pods": [ + { + "pod": "api-747c44bcb7-rvzfc", + "uid": "7501101b-8fa6-4093-84c1-3b2a449ff6e5", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 104312832, + "memory_peak_bytes": 111087616, + "cpu_usage_usec": 701319, + "limits": { + "cpu": "1", + "memory": "512Mi" + } + } + ] + }, + "postgres_wait_samples": [ + { + "at": "2026-11-12T17:24:47.091663+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:47.293809+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:47.495771+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:47.697785+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:47.899818+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:48.101722+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:48.303728+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:48.505694+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:48.707675+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:24:48.909675+00:00", + "events": [ + { + "count": 2, + "wait_event": "transactionid", + "wait_event_type": "Lock" + }, + { + "count": 1, + "wait_event": null, + "wait_event_type": null + } + ] + } + ], + "messages": 592 + }, + { + "phase": "growing", + "replicas": 2, + "repeat": 1, + "pool": 8, + "api_cpu_each": 1, + "api_memory_mb_each": 512, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.141, + "concurrency": 16, + "successful_requests": 602, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 117.087, + "successful_latency_ms": { + "p50": 133.446, + "p95": 242.025, + "p99": 300.401 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": { + "at": "2026-11-12T17:25:04.613Z", + "pods": [ + { + "pod": "api-747c44bcb7-rvzfc", + "uid": "7501101b-8fa6-4093-84c1-3b2a449ff6e5", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 100884480, + "memory_peak_bytes": 113545216, + "cpu_usage_usec": 1014983, + "limits": { + "cpu": "1", + "memory": "512Mi" + } + }, + { + "pod": "api-747c44bcb7-txnq7", + "uid": "b7bfb2cf-caae-40c3-ba6a-27cc5d1ccf3b", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 77819904, + "memory_peak_bytes": 79020032, + "cpu_usage_usec": 154198, + "limits": { + "cpu": "1", + "memory": "512Mi" + } + } + ] + }, + "postgres_wait_samples": [ + { + "at": "2026-11-12T17:25:03.357038+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:03.559324+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:03.761306+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:03.963297+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 5, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:04.165374+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:04.367473+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:04.569393+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:04.771347+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:04.973338+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:05.175247+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + } + ], + "messages": 602 + }, + { + "phase": "growing", + "replicas": 2, + "repeat": 2, + "pool": 8, + "api_cpu_each": 1, + "api_memory_mb_each": 512, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.206, + "concurrency": 16, + "successful_requests": 483, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 92.784, + "successful_latency_ms": { + "p50": 150.206, + "p95": 416.852, + "p99": 758.495 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": { + "at": "2026-11-12T17:25:10.945Z", + "pods": [ + { + "pod": "api-747c44bcb7-rvzfc", + "uid": "7501101b-8fa6-4093-84c1-3b2a449ff6e5", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 103182336, + "memory_peak_bytes": 113545216, + "cpu_usage_usec": 1245917, + "limits": { + "cpu": "1", + "memory": "512Mi" + } + }, + { + "pod": "api-747c44bcb7-txnq7", + "uid": "b7bfb2cf-caae-40c3-ba6a-27cc5d1ccf3b", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 83423232, + "memory_peak_bytes": 84692992, + "cpu_usage_usec": 382782, + "limits": { + "cpu": "1", + "memory": "512Mi" + } + } + ] + }, + "postgres_wait_samples": [ + { + "at": "2026-11-12T17:25:09.699651+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:09.901951+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:10.10392+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:10.3059+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:10.507766+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 6, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:10.709747+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 6, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:10.912029+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 6, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:11.114131+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:11.31603+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:11.518003+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 7, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + } + ], + "messages": 483 + }, + { + "phase": "growing", + "replicas": 4, + "repeat": 1, + "pool": 8, + "api_cpu_each": 1, + "api_memory_mb_each": 512, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.149, + "concurrency": 16, + "successful_requests": 587, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 113.996, + "successful_latency_ms": { + "p50": 108.526, + "p95": 341.859, + "p99": 509.083 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": { + "at": "2026-11-12T17:25:25.478Z", + "pods": [ + { + "pod": "api-747c44bcb7-95mz2", + "uid": "f4a98732-3b30-40bd-a7ad-16a3a4e442c7", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 76308480, + "memory_peak_bytes": 78766080, + "cpu_usage_usec": 103675, + "limits": { + "cpu": "1", + "memory": "512Mi" + } + }, + { + "pod": "api-747c44bcb7-bxbtv", + "uid": "8e14a709-f569-4ba4-8562-dd1544fcd2ad", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 42807296, + "memory_peak_bytes": 44990464, + "cpu_usage_usec": 83023, + "limits": { + "cpu": "1", + "memory": "512Mi" + } + }, + { + "pod": "api-747c44bcb7-rvzfc", + "uid": "7501101b-8fa6-4093-84c1-3b2a449ff6e5", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 102903808, + "memory_peak_bytes": 113545216, + "cpu_usage_usec": 1416857, + "limits": { + "cpu": "1", + "memory": "512Mi" + } + }, + { + "pod": "api-747c44bcb7-txnq7", + "uid": "b7bfb2cf-caae-40c3-ba6a-27cc5d1ccf3b", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 89632768, + "memory_peak_bytes": 91418624, + "cpu_usage_usec": 521364, + "limits": { + "cpu": "1", + "memory": "512Mi" + } + } + ] + }, + "postgres_wait_samples": [ + { + "at": "2026-11-12T17:25:23.895155+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 11, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:24.097317+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 13, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:24.299275+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 13, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:24.501282+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 14, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:24.703291+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 12, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:24.905648+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 11, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:25.107702+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 15, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:25.309713+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 13, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:25.511741+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 14, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:25.713847+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 12, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + } + ], + "messages": 587 + }, + { + "phase": "growing", + "replicas": 4, + "repeat": 2, + "pool": 8, + "api_cpu_each": 1, + "api_memory_mb_each": 512, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.151, + "concurrency": 16, + "successful_requests": 609, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 118.235, + "successful_latency_ms": { + "p50": 108.462, + "p95": 333.75, + "p99": 458.974 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": { + "at": "2026-11-12T17:25:32.090Z", + "pods": [ + { + "pod": "api-747c44bcb7-95mz2", + "uid": "f4a98732-3b30-40bd-a7ad-16a3a4e442c7", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 83062784, + "memory_peak_bytes": 84545536, + "cpu_usage_usec": 207717, + "limits": { + "cpu": "1", + "memory": "512Mi" + } + }, + { + "pod": "api-747c44bcb7-bxbtv", + "uid": "8e14a709-f569-4ba4-8562-dd1544fcd2ad", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 78548992, + "memory_peak_bytes": 80551936, + "cpu_usage_usec": 190746, + "limits": { + "cpu": "1", + "memory": "512Mi" + } + }, + { + "pod": "api-747c44bcb7-rvzfc", + "uid": "7501101b-8fa6-4093-84c1-3b2a449ff6e5", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 102670336, + "memory_peak_bytes": 113545216, + "cpu_usage_usec": 1552709, + "limits": { + "cpu": "1", + "memory": "512Mi" + } + }, + { + "pod": "api-747c44bcb7-txnq7", + "uid": "b7bfb2cf-caae-40c3-ba6a-27cc5d1ccf3b", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 90841088, + "memory_peak_bytes": 92647424, + "cpu_usage_usec": 652048, + "limits": { + "cpu": "1", + "memory": "512Mi" + } + } + ] + }, + "postgres_wait_samples": [ + { + "at": "2026-11-12T17:25:30.519345+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 13, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:30.721466+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 12, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:30.923439+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 11, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:31.125455+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 11, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:31.327416+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 14, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:31.529604+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 12, + "wait_event": "transactionid", + "wait_event_type": "Lock" + }, + { + "count": 1, + "wait_event": null, + "wait_event_type": null + } + ] + }, + { + "at": "2026-11-12T17:25:31.731694+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 12, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:31.933755+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 13, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:32.135778+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 13, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:32.337798+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 14, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + } + ], + "messages": 609 + }, + { + "phase": "pool", + "replicas": 1, + "repeat": 1, + "pool": 8, + "api_cpu_each": 2, + "api_memory_mb_each": 2048, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.141, + "concurrency": 16, + "successful_requests": 609, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 118.461, + "successful_latency_ms": { + "p50": 125.254, + "p95": 166.879, + "p99": 191.926 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": { + "at": "2026-11-12T17:25:56.333Z", + "pods": [ + { + "pod": "api-86f89bb65c-45rpx", + "uid": "2031e621-bc66-497f-8afd-ba6e88493b0f", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 77598720, + "memory_peak_bytes": 78876672, + "cpu_usage_usec": 272089, + "limits": { + "cpu": "2", + "memory": "2Gi" + } + } + ] + }, + "postgres_wait_samples": [ + { + "at": "2026-11-12T17:25:55.213514+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:55.415825+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:55.617694+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:55.819708+00:00", + "events": [ + { + "count": 2, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:56.021685+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:56.223736+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:56.425827+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:56.627815+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:56.829861+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:25:57.03176+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + } + ], + "messages": 609 + }, + { + "phase": "pool", + "replicas": 1, + "repeat": 2, + "pool": 1, + "api_cpu_each": 2, + "api_memory_mb_each": 2048, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.139, + "concurrency": 16, + "successful_requests": 598, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 116.366, + "successful_latency_ms": { + "p50": 133.437, + "p95": 166.377, + "p99": 216.771 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": { + "at": "2026-11-12T17:26:21.189Z", + "pods": [ + { + "pod": "api-6cd6887f7b-5blcp", + "uid": "0f54a50b-88f2-4962-8d64-1522e7e5e0a9", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 77242368, + "memory_peak_bytes": 78651392, + "cpu_usage_usec": 267649, + "limits": { + "cpu": "2", + "memory": "2Gi" + } + } + ] + }, + "postgres_wait_samples": [ + { + "at": "2026-11-12T17:26:20.084476+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + }, + { + "at": "2026-11-12T17:26:20.286551+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + }, + { + "at": "2026-11-12T17:26:20.488415+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + }, + { + "at": "2026-11-12T17:26:20.690292+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + }, + { + "at": "2026-11-12T17:26:20.892314+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + }, + { + "at": "2026-11-12T17:26:21.094276+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + }, + { + "at": "2026-11-12T17:26:21.296227+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + }, + { + "at": "2026-11-12T17:26:21.498192+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + }, + { + "at": "2026-11-12T17:26:21.700148+00:00", + "events": [ + { + "count": 1, + "wait_event": null, + "wait_event_type": null + } + ] + }, + { + "at": "2026-11-12T17:26:21.90206+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + } + ], + "messages": 598 + }, + { + "phase": "pool", + "replicas": 1, + "repeat": 3, + "pool": 1, + "api_cpu_each": 2, + "api_memory_mb_each": 2048, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.138, + "concurrency": 16, + "successful_requests": 565, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 109.975, + "successful_latency_ms": { + "p50": 133.462, + "p95": 208.454, + "p99": 341.772 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": { + "at": "2026-11-12T17:26:27.337Z", + "pods": [ + { + "pod": "api-6cd6887f7b-5blcp", + "uid": "0f54a50b-88f2-4962-8d64-1522e7e5e0a9", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 104058880, + "memory_peak_bytes": 104804352, + "cpu_usage_usec": 685137, + "limits": { + "cpu": "2", + "memory": "2Gi" + } + } + ] + }, + "postgres_wait_samples": [ + { + "at": "2026-11-12T17:26:26.240666+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + }, + { + "at": "2026-11-12T17:26:26.443006+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + }, + { + "at": "2026-11-12T17:26:26.644949+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + }, + { + "at": "2026-11-12T17:26:26.846928+00:00", + "events": [ + { + "count": 1, + "wait_event": null, + "wait_event_type": null + } + ] + }, + { + "at": "2026-11-12T17:26:27.048942+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + }, + { + "at": "2026-11-12T17:26:27.250993+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + }, + { + "at": "2026-11-12T17:26:27.452993+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + }, + { + "at": "2026-11-12T17:26:27.655011+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + }, + { + "at": "2026-11-12T17:26:27.85705+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + }, + { + "at": "2026-11-12T17:26:28.059015+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + } + ] + } + ], + "messages": 565 + }, + { + "phase": "pool", + "replicas": 1, + "repeat": 4, + "pool": 8, + "api_cpu_each": 2, + "api_memory_mb_each": 2048, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.149, + "concurrency": 16, + "successful_requests": 596, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 115.747, + "successful_latency_ms": { + "p50": 133.393, + "p95": 183.591, + "p99": 258.514 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": { + "at": "2026-11-12T17:26:52.018Z", + "pods": [ + { + "pod": "api-86f89bb65c-h6pph", + "uid": "5e165b2c-e8ef-49fc-b561-650870ed5dd3", + "image": "sha256:c96e701f8c410041388e920e3f7880726c5f8c3595932652a48db23c814c4370", + "memory_current_bytes": 77524992, + "memory_peak_bytes": 79040512, + "cpu_usage_usec": 276398, + "limits": { + "cpu": "2", + "memory": "2Gi" + } + } + ] + }, + "postgres_wait_samples": [ + { + "at": "2026-11-12T17:26:50.907667+00:00", + "events": [ + { + "count": 1, + "wait_event": "ClientRead", + "wait_event_type": "Client" + }, + { + "count": 2, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:26:51.109881+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:26:51.311843+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:26:51.513789+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:26:51.715765+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:26:51.917866+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:26:52.119879+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:26:52.321883+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:26:52.523809+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + }, + { + "at": "2026-11-12T17:26:52.725767+00:00", + "events": [ + { + "count": 1, + "wait_event": "WalSync", + "wait_event_type": "IO" + }, + { + "count": 3, + "wait_event": "transactionid", + "wait_event_type": "Lock" + } + ] + } + ], + "messages": 596 + } + ], + "rolling": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 30, + "elapsed_seconds": 30.073, + "concurrency": 8, + "successful_requests": 2725, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 90.612, + "successful_latency_ms": { + "p50": 58.545, + "p95": 219.169, + "p99": 566.767 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + } +} diff --git a/evidence/k3s/restart-after.json b/evidence/k3s/restart-after.json new file mode 100644 index 00000000..723132da --- /dev/null +++ b/evidence/k3s/restart-after.json @@ -0,0 +1,35 @@ +{ + "run_id": "57b143da-67d6-460e-b4aa-42f520875902", + "pods": [ + { + "name": "api-74b8cdc5b8-2bsjs", + "uid": "ffe9645a-a53b-4dc7-bca5-a7d2eb409025", + "role": "api", + "started": "2026-11-12T16:15:37Z" + }, + { + "name": "api-74b8cdc5b8-sgt22", + "uid": "fc6c9107-a20c-4746-bf77-2fb4a44df076", + "role": "api", + "started": "2026-11-12T16:16:03Z" + }, + { + "name": "pingap-649fd76464-mdg9s", + "uid": "b7fe1a23-7855-41a9-a5a2-170821aa6b66", + "role": "pingap", + "started": "2026-11-12T16:15:37Z" + }, + { + "name": "postgres-7dd8bb6cfb-jrncm", + "uid": "66a45a9c-4316-4074-b35d-536d625482a1", + "role": "postgres", + "started": "2026-11-12T16:15:48Z" + }, + { + "name": "valkey-56578fdc9-dwgns", + "uid": "55b68de7-8bc0-4ddc-a7f9-db9583f7668d", + "role": "valkey", + "started": "2026-11-12T16:15:41Z" + } + ] +} diff --git a/evidence/k3s/restart-before.json b/evidence/k3s/restart-before.json new file mode 100644 index 00000000..0786fad4 --- /dev/null +++ b/evidence/k3s/restart-before.json @@ -0,0 +1,35 @@ +{ + "run_id": "57b143da-67d6-460e-b4aa-42f520875902", + "pods": [ + { + "name": "api-586bc967c4-n42nx", + "uid": "9724c831-5e1f-44e3-9c8e-b4c6c426d939", + "role": "api", + "started": "2026-11-12T15:20:18Z" + }, + { + "name": "api-586bc967c4-wgzv9", + "uid": "1e4ef2ba-9c63-4416-b34b-0261e3909912", + "role": "api", + "started": "2026-11-12T15:19:49Z" + }, + { + "name": "pingap-5457b8c9fd-kqbtx", + "uid": "17a16231-898c-48bf-a2bd-11b0b15cefa4", + "role": "pingap", + "started": "2026-11-12T15:59:42Z" + }, + { + "name": "postgres-57b4c96d94-66l45", + "uid": "7f1aa510-a6b8-449e-b0e5-c9d00ee23e57", + "role": "postgres", + "started": "2026-11-12T15:59:45Z" + }, + { + "name": "valkey-76bdbc5dd9-9zwgg", + "uid": "97bf614a-4295-4fbb-afca-ff98b2125efe", + "role": "valkey", + "started": "2026-11-12T15:20:11Z" + } + ] +} diff --git a/evidence/k3s/restart-postcondition.txt b/evidence/k3s/restart-postcondition.txt new file mode 100644 index 00000000..a28fd660 --- /dev/null +++ b/evidence/k3s/restart-postcondition.txt @@ -0,0 +1 @@ +PASS: every recorded original workload Pod UID was replaced diff --git a/evidence/k3s/smoke.txt b/evidence/k3s/smoke.txt new file mode 100644 index 00000000..3dde5fa6 --- /dev/null +++ b/evidence/k3s/smoke.txt @@ -0,0 +1,2 @@ +python3 tests/smoke.py --base-url "http://127.0.0.1:28203" +PASS: lab3 public API scenario; infrastructure and grading evidence remain separate. diff --git a/evidence/k3s/stdio-red.txt b/evidence/k3s/stdio-red.txt new file mode 100644 index 00000000..6243ecf3 --- /dev/null +++ b/evidence/k3s/stdio-red.txt @@ -0,0 +1,11 @@ +1 | import {resolve} from 'node:path'; +2 | const root=resolve(import.meta.dir,'..'); +3 | const p=Bun.spawn([resolve(root,'scripts/kube.sh'),'exec','-i','deployment/postgres','--','psql','-X','-qAt','-U','messenger','-d','messenger','-v','ON_ERROR_STOP=1'],{cwd:root,stdin:'pipe',stdout:'pipe',stderr:'pipe'}); +4 | p.stdin.write("SELECT 'stdin-boundary-ok';\n");p.stdin.end(); +5 | const [out,err]=await Promise.all([new Response(p.stdout).text(),new Response(p.stderr).text()]); +6 | if(await p.exited!==0||out.trim()!=='stdin-boundary-ok')throw new Error('Kubernetes wrapper did not execute the stdin query'); + ^ +error: Kubernetes wrapper did not execute the stdin query + at /mnt/data/home/bench-saves/vp-k3s-nHACGCQi/lab3/student-tests/kube-stdin.ts:6:67 + +Bun v1.4.4 (Linux x64) diff --git a/evidence/k3s/stdio.txt b/evidence/k3s/stdio.txt new file mode 100644 index 00000000..943b21cf --- /dev/null +++ b/evidence/k3s/stdio.txt @@ -0,0 +1 @@ +PASS: SQL stdin reaches PostgreSQL through the real scoped wrapper diff --git a/evidence/k3s/stop-one-after.json b/evidence/k3s/stop-one-after.json new file mode 100644 index 00000000..12743bbb --- /dev/null +++ b/evidence/k3s/stop-one-after.json @@ -0,0 +1,7 @@ +{ + "stopped": "api-74b8cdc5b8-6jm4t", + "stoppedUID": "25b15dbb-d299-458f-8858-11ee7b2784ed", + "containerID": "e56cafd1185db588a28a997fa1f86d3d47deeb9813a272df817656a80067fa4f", + "state": "CONTAINER_EXITED", + "survivor": "api-74b8cdc5b8-k97kn" +} \ No newline at end of file diff --git a/evidence/k3s/stop-one-before.json b/evidence/k3s/stop-one-before.json new file mode 100644 index 00000000..5d7162ca --- /dev/null +++ b/evidence/k3s/stop-one-before.json @@ -0,0 +1,8 @@ +{ + "target": "api-74b8cdc5b8-6jm4t", + "uid": "25b15dbb-d299-458f-8858-11ee7b2784ed", + "pods": [ + "api-74b8cdc5b8-6jm4t", + "api-74b8cdc5b8-k97kn" + ] +} \ No newline at end of file diff --git a/evidence/k3s/stopped-1-after.json b/evidence/k3s/stopped-1-after.json new file mode 100644 index 00000000..5368a60f --- /dev/null +++ b/evidence/k3s/stopped-1-after.json @@ -0,0 +1,7 @@ +{ + "stopped": "api-5487848cc8-b8rmq", + "stoppedUID": "bc8f65b4-e0a7-4c72-bbd3-1064730a3956", + "containerID": "94375fa643d61b7961699fcf2b507cea572369e36c3313bf262eafb06236b47b", + "state": "CONTAINER_EXITED", + "survivor": "api-5487848cc8-wk4q9" +} \ No newline at end of file diff --git a/evidence/k3s/stopped-1-before.json b/evidence/k3s/stopped-1-before.json new file mode 100644 index 00000000..afc8e015 --- /dev/null +++ b/evidence/k3s/stopped-1-before.json @@ -0,0 +1,8 @@ +{ + "target": "api-5487848cc8-b8rmq", + "uid": "bc8f65b4-e0a7-4c72-bbd3-1064730a3956", + "pods": [ + "api-5487848cc8-b8rmq", + "api-5487848cc8-wk4q9" + ] +} \ No newline at end of file diff --git a/evidence/k3s/stopped-2-after.json b/evidence/k3s/stopped-2-after.json new file mode 100644 index 00000000..2ac4ae97 --- /dev/null +++ b/evidence/k3s/stopped-2-after.json @@ -0,0 +1,7 @@ +{ + "stopped": "api-5487848cc8-2ptlv", + "stoppedUID": "c3c36c79-4ec6-479c-b9b1-b5097d663ecb", + "containerID": "c6195af6465e6edf4bdcd3e0996f068e1ac9b446c7ce52a0e74f42d07403dc66", + "state": "CONTAINER_EXITED", + "survivor": "api-5487848cc8-wk4q9" +} \ No newline at end of file diff --git a/evidence/k3s/units.txt b/evidence/k3s/units.txt new file mode 100644 index 00000000..993f2a1c --- /dev/null +++ b/evidence/k3s/units.txt @@ -0,0 +1,50 @@ +bun test v1.4.4 (38afee6c8) + +student-tests/k3s-model.test.ts: +(pass) rejects an image API budget below the verified decoder limit [0.18ms] +(pass) accepts the verified image API budget [14.27ms] +(pass) allows smaller text-only API research budgets [0.12ms] +(pass) cleanup failure preserves the original operation error [0.47ms] +(pass) cleanup failure cannot publish a successful operation [0.12ms] +(pass) accepts the canonical Docker Hub form of a pinned repository [0.24ms] +(pass) rejects foreign or malformed cluster platform [0.17ms] +(pass) rejects foreign or malformed cluster vp-lab4-medvedev [0.01ms] +(pass) rejects foreign or malformed cluster ../vp-lab3 +(pass) rejects foreign or malformed cluster vp-lab3;echo +(pass) rejects invalid public port 0 [0.05ms] +(pass) rejects invalid public port 65536 [0.01ms] +(pass) rejects invalid public port NaN +(pass) rejects invalid public port 28203;echo +(pass) accepts default and isolated experiment names [0.02ms] +(pass) rejects an unclaimed cluster [0.05ms] +(pass) rejects a recreated foreign container [0.03ms] +(pass) rejects a replaced namespace [0.03ms] +(pass) accepts the exact claimed cluster and namespace [0.02ms] +(pass) foreign cluster never reaches the mutation port [0.20ms] +(pass) inventory failure never reaches the mutation port [0.10ms] +(pass) claimed cluster dispatches the requested action once [0.14ms] +(pass) accepts pinned manifest identity when image config ID differs [0.02ms] +(pass) rejects an unpinned image [0.03ms] +(pass) rejects target or resource override [ "get", "pods", "-nforeign" ] [0.17ms] +(pass) rejects target or resource override [ "get", "pods", "--cluster=foreign" ] +(pass) rejects target or resource override [ "get", "nodes" ] [0.10ms] +(pass) rejects target or resource override [ "get", "secrets" ] [0.02ms] +(pass) allows flags belonging to the executed application [0.12ms] +(pass) allows stdin for scoped PostgreSQL execution [0.03ms] +(pass) rejects a second resource that discloses a Secret [0.03ms] +(pass) rejects the short server override [0.02ms] +(pass) refuses measurement for active or unknown game status 0 [0.04ms] +(pass) refuses measurement for active or unknown game status 2 +(pass) refuses measurement for active or unknown game status -1 +(pass) accepts measurement only for confirmed inactive game [0.02ms] +(pass) rejects extra resources after delimiter outside exec [0.02ms] +(pass) partial cleanup accepts only the exclusive server owner nonce [0.07ms] +(pass) partial cleanup never weakens a ready namespace guard [0.03ms] +(pass) partial cleanup accepts an owned server before namespace creation [0.02ms] +(pass) rejects a running replacement process despite stale Kubernetes status [0.04ms] +(pass) accepts native absence of the victim process [0.04ms] + + 42 pass + 0 fail + 45 expect() calls +Ran 42 tests across 1 file. [44.00ms] diff --git a/evidence/lint.txt b/evidence/lint.txt new file mode 100644 index 00000000..6a3ebaa7 --- /dev/null +++ b/evidence/lint.txt @@ -0,0 +1 @@ +0 issues. diff --git a/evidence/persistence.txt b/evidence/persistence.txt new file mode 100644 index 00000000..80a4ff1d --- /dev/null +++ b/evidence/persistence.txt @@ -0,0 +1,3 @@ +/mnt/data/home/bench-saves/vp-labs-vuIKezo9/lab3/.venv/bin/python tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://127.0.0.1:28203" +Executing explicit persistence hook; hook output suppressed to avoid leaking secrets. +PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence. diff --git a/evidence/ready-after-persistence.txt b/evidence/ready-after-persistence.txt new file mode 100644 index 00000000..135231eb --- /dev/null +++ b/evidence/ready-after-persistence.txt @@ -0,0 +1 @@ +Ready: 2 API process(es) diff --git a/evidence/ready.txt b/evidence/ready.txt new file mode 100644 index 00000000..135231eb --- /dev/null +++ b/evidence/ready.txt @@ -0,0 +1 @@ +Ready: 2 API process(es) diff --git a/evidence/red-lab3.txt b/evidence/red-lab3.txt new file mode 100644 index 00000000..0287c6db --- /dev/null +++ b/evidence/red-lab3.txt @@ -0,0 +1 @@ +FAIL: missing X-Instance-Id diff --git a/evidence/research/run-ImJmOz/fixed-1-8-1.json b/evidence/research/run-ImJmOz/fixed-1-8-1.json new file mode 100644 index 00000000..71acc1d7 --- /dev/null +++ b/evidence/research/run-ImJmOz/fixed-1-8-1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.149, + "concurrency": 16, + "successful_requests": 604, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 117.315, + "successful_latency_ms": { + "p50": 133.434, + "p95": 166.882, + "p99": 184.769 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-ImJmOz/fixed-1-8-2.json b/evidence/research/run-ImJmOz/fixed-1-8-2.json new file mode 100644 index 00000000..1f046413 --- /dev/null +++ b/evidence/research/run-ImJmOz/fixed-1-8-2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.14, + "concurrency": 16, + "successful_requests": 607, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 118.087, + "successful_latency_ms": { + "p50": 133.386, + "p95": 175.111, + "p99": 200.193 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-ImJmOz/fixed-2-8-1.json b/evidence/research/run-ImJmOz/fixed-2-8-1.json new file mode 100644 index 00000000..3c2eaeb4 --- /dev/null +++ b/evidence/research/run-ImJmOz/fixed-2-8-1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.14, + "concurrency": 16, + "successful_requests": 600, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 116.742, + "successful_latency_ms": { + "p50": 133.445, + "p95": 258.615, + "p99": 342.106 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-ImJmOz/fixed-2-8-2.json b/evidence/research/run-ImJmOz/fixed-2-8-2.json new file mode 100644 index 00000000..10e4f0e1 --- /dev/null +++ b/evidence/research/run-ImJmOz/fixed-2-8-2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.144, + "concurrency": 16, + "successful_requests": 562, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 109.247, + "successful_latency_ms": { + "p50": 133.488, + "p95": 316.996, + "p99": 375.102 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-ImJmOz/fixed-4-8-1.json b/evidence/research/run-ImJmOz/fixed-4-8-1.json new file mode 100644 index 00000000..3f2019e1 --- /dev/null +++ b/evidence/research/run-ImJmOz/fixed-4-8-1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.143, + "concurrency": 16, + "successful_requests": 602, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 117.062, + "successful_latency_ms": { + "p50": 108.454, + "p95": 333.843, + "p99": 442.317 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-ImJmOz/fixed-4-8-2.json b/evidence/research/run-ImJmOz/fixed-4-8-2.json new file mode 100644 index 00000000..d8adeb6f --- /dev/null +++ b/evidence/research/run-ImJmOz/fixed-4-8-2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.141, + "concurrency": 16, + "successful_requests": 598, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 116.32, + "successful_latency_ms": { + "p50": 108.487, + "p95": 358.782, + "p99": 475.655 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-ImJmOz/growing-1-8-1.json b/evidence/research/run-ImJmOz/growing-1-8-1.json new file mode 100644 index 00000000..c3391b1c --- /dev/null +++ b/evidence/research/run-ImJmOz/growing-1-8-1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.141, + "concurrency": 16, + "successful_requests": 593, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 115.34, + "successful_latency_ms": { + "p50": 133.458, + "p95": 183.338, + "p99": 225.146 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-ImJmOz/growing-1-8-2.json b/evidence/research/run-ImJmOz/growing-1-8-2.json new file mode 100644 index 00000000..0511ee1f --- /dev/null +++ b/evidence/research/run-ImJmOz/growing-1-8-2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.149, + "concurrency": 16, + "successful_requests": 608, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 118.078, + "successful_latency_ms": { + "p50": 133.366, + "p95": 168.029, + "p99": 200.224 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-ImJmOz/growing-2-8-1.json b/evidence/research/run-ImJmOz/growing-2-8-1.json new file mode 100644 index 00000000..99243b9c --- /dev/null +++ b/evidence/research/run-ImJmOz/growing-2-8-1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.15, + "concurrency": 16, + "successful_requests": 608, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 118.067, + "successful_latency_ms": { + "p50": 133.605, + "p95": 275.297, + "p99": 333.729 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-ImJmOz/growing-2-8-2.json b/evidence/research/run-ImJmOz/growing-2-8-2.json new file mode 100644 index 00000000..2e08b28b --- /dev/null +++ b/evidence/research/run-ImJmOz/growing-2-8-2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.167, + "concurrency": 16, + "successful_requests": 608, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 117.681, + "successful_latency_ms": { + "p50": 133.469, + "p95": 241.935, + "p99": 300.372 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-ImJmOz/growing-4-8-1.json b/evidence/research/run-ImJmOz/growing-4-8-1.json new file mode 100644 index 00000000..2f7d1524 --- /dev/null +++ b/evidence/research/run-ImJmOz/growing-4-8-1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.15, + "concurrency": 16, + "successful_requests": 605, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 117.487, + "successful_latency_ms": { + "p50": 105.327, + "p95": 342.192, + "p99": 467.389 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-ImJmOz/growing-4-8-2.json b/evidence/research/run-ImJmOz/growing-4-8-2.json new file mode 100644 index 00000000..c9136c14 --- /dev/null +++ b/evidence/research/run-ImJmOz/growing-4-8-2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.151, + "concurrency": 16, + "successful_requests": 601, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 116.686, + "successful_latency_ms": { + "p50": 100.22, + "p95": 342.158, + "p99": 525.685 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-ImJmOz/hardware.json b/evidence/research/run-ImJmOz/hardware.json new file mode 100644 index 00000000..e50ca53e --- /dev/null +++ b/evidence/research/run-ImJmOz/hardware.json @@ -0,0 +1,30 @@ +[ + { + "field": "CPU(s):", + "data": "16" + }, + { + "field": "On-line CPU(s) list:", + "data": "0-15" + }, + { + "field": "Model name:", + "data": "AMD Ryzen 7 5700X 8-Core Processor" + }, + { + "field": "Thread(s) per core:", + "data": "2" + }, + { + "field": "Core(s) per socket:", + "data": "8" + }, + { + "field": "CPU(s) scaling MHz:", + "data": "82%" + }, + { + "field": "NUMA node0 CPU(s):", + "data": "0-15" + } +] diff --git a/evidence/research/run-ImJmOz/pool-1-1-1.json b/evidence/research/run-ImJmOz/pool-1-1-1.json new file mode 100644 index 00000000..f708a845 --- /dev/null +++ b/evidence/research/run-ImJmOz/pool-1-1-1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.147, + "concurrency": 16, + "successful_requests": 611, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 118.702, + "successful_latency_ms": { + "p50": 133.434, + "p95": 134.637, + "p99": 166.743 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-ImJmOz/pool-1-1-2.json b/evidence/research/run-ImJmOz/pool-1-1-2.json new file mode 100644 index 00000000..31b50334 --- /dev/null +++ b/evidence/research/run-ImJmOz/pool-1-1-2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.138, + "concurrency": 16, + "successful_requests": 609, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 118.536, + "successful_latency_ms": { + "p50": 133.439, + "p95": 141.77, + "p99": 166.75 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-ImJmOz/pool-1-8-1.json b/evidence/research/run-ImJmOz/pool-1-8-1.json new file mode 100644 index 00000000..947f3979 --- /dev/null +++ b/evidence/research/run-ImJmOz/pool-1-8-1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.157, + "concurrency": 16, + "successful_requests": 536, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 103.939, + "successful_latency_ms": { + "p50": 133.518, + "p95": 308.743, + "p99": 458.453 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-ImJmOz/pool-1-8-2.json b/evidence/research/run-ImJmOz/pool-1-8-2.json new file mode 100644 index 00000000..79e95c41 --- /dev/null +++ b/evidence/research/run-ImJmOz/pool-1-8-2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.141, + "concurrency": 16, + "successful_requests": 584, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 113.604, + "successful_latency_ms": { + "p50": 133.411, + "p95": 200.205, + "p99": 283.495 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-ImJmOz/pool.svg b/evidence/research/run-ImJmOz/pool.svg new file mode 100644 index 00000000..ce44df71 --- /dev/null +++ b/evidence/research/run-ImJmOz/pool.svg @@ -0,0 +1,371 @@ + + + + + + + + 2026-11-12T16:36:06.034355 + image/svg+xml + + + Matplotlib v3.11.2, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pool = 8 + + + + + + + + + + pool = 1 + + + + + + + + + + + + + + + 0 + + + + + + + + + + 20 + + + + + + + + + + 40 + + + + + + + + + + 60 + + + + + + + + + + 80 + + + + + + + + + + 100 + + + + + + + + + + 120 + + + + Successful req/s + + + + + + + + + + + + + + + + 117.78 + + + 118.52 + + + + + + + + + + + + + + + + + + + + + pool = 8 + + + + + + + + + + pool = 1 + + + + + + + + + + + + 0 + + + + + + + + + + 20 + + + + + + + + + + 40 + + + + + + + + + + 60 + + + + + + + + + + 80 + + + + + + + + + + 100 + + + + + + + + + + 120 + + + + + + + + + + 140 + + + + + + + + + + 160 + + + + p95, ms + + + + + + + + + + + + + + + + 166.86 + + + 145.97 + + + + One hot sender; same single-replica CPU/RAM budget + + + + + + + + + + + diff --git a/evidence/research/run-ImJmOz/replacements.json b/evidence/research/run-ImJmOz/replacements.json new file mode 100644 index 00000000..3c4a72ba --- /dev/null +++ b/evidence/research/run-ImJmOz/replacements.json @@ -0,0 +1,12 @@ +[ + { + "old_container": "0f65a8cef2ee", + "messages_before": 31, + "messages_after": 208 + }, + { + "old_container": "93674ffdda1a", + "messages_before": 218, + "messages_after": 362 + } +] diff --git a/evidence/research/run-ImJmOz/rolling.json b/evidence/research/run-ImJmOz/rolling.json new file mode 100644 index 00000000..5c3ef35d --- /dev/null +++ b/evidence/research/run-ImJmOz/rolling.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 30.0, + "elapsed_seconds": 30.067, + "concurrency": 8, + "successful_requests": 2684, + "failed_requests": 46, + "error_ratio": 0.01685, + "successful_rps": 89.267, + "successful_latency_ms": { + "p50": 58.444, + "p95": 217.042, + "p99": 544.068 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-ImJmOz/run.json b/evidence/research/run-ImJmOz/run.json new file mode 100644 index 00000000..f1d87799 --- /dev/null +++ b/evidence/research/run-ImJmOz/run.json @@ -0,0 +1 @@ +{"run_id":"190f41a4","started_at":"2026-11-12T13:15:26.167Z","state":"started","project":"vp-lab3-research-190f41a4"} diff --git a/evidence/research/run-ImJmOz/scaling.svg b/evidence/research/run-ImJmOz/scaling.svg new file mode 100644 index 00000000..4da83ff6 --- /dev/null +++ b/evidence/research/run-ImJmOz/scaling.svg @@ -0,0 +1,740 @@ + + + + + + + + 2026-11-12T16:36:05.906248 + image/svg+xml + + + Matplotlib v3.11.2, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + 2 + + + + + + + + + + + + + 4 + + + + API replicas + + + + + + + + + + + + + + + + + 110 + + + + + + + + + + + + + 112 + + + + + + + + + + + + + 114 + + + + + + + + + + + + + 116 + + + + + + + + + + + + + 118 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Successful requests / second + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fixed total API CPU/RAM + + + + + + + + + + + + + + + + + + + + + + + + Resources grow with replicas + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + 2 + + + + + + + + + + + + + 4 + + + + API replicas + + + + + + + + + + + + + + 175 + + + + + + + + + + + + + 200 + + + + + + + + + + + + + 225 + + + + + + + + + + + + + 250 + + + + + + + + + + + + + 275 + + + + + + + + + + + + + 300 + + + + + + + + + + + + + 325 + + + + + + + + + + + + + 350 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + p95 of successful requests, ms + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fixed total API CPU/RAM + + + + + + + + + + + + + + + + + + + + + + + + Resources grow with replicas + + + + + Closed loop, concurrency 16, 5 seconds; mean and range of two runs + + + + + + + + + + + diff --git a/evidence/research/run-ImJmOz/summary.json b/evidence/research/run-ImJmOz/summary.json new file mode 100644 index 00000000..5c2eb02c --- /dev/null +++ b/evidence/research/run-ImJmOz/summary.json @@ -0,0 +1,2725 @@ +{ + "run_id": "190f41a4", + "valid": true, + "complete": true, + "expected_samples": 16, + "profile": "closed-loop POST text, concurrency16,5seconds,2repetitions; fresh DB data for each run", + "samples": [ + { + "phase": "fixed", + "replicas": 1, + "repeat": 1, + "pool": 8, + "api_cpu_each": 2, + "api_memory_mb_each": 2048, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.149, + "concurrency": 16, + "successful_requests": 604, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 117.315, + "successful_latency_ms": { + "p50": 133.434, + "p95": 166.882, + "p99": 184.769 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-190f41a4-api-1", + "cpu_percent": "7.97%", + "memory": "72.78MiB / 2GiB" + }, + { + "name": "vp-lab3-research-190f41a4-lb-1", + "cpu_percent": "4.66%", + "memory": "18.95MiB / 128MiB" + }, + { + "name": "vp-lab3-research-190f41a4-postgres-1", + "cpu_percent": "24.83%", + "memory": "42.36MiB / 768MiB" + }, + { + "name": "vp-lab3-research-190f41a4-valkey-1", + "cpu_percent": "0.36%", + "memory": "10.6MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "Client", + "wait_event": "ClientRead", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 2 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ] + ], + "messages": 604 + }, + { + "phase": "fixed", + "replicas": 1, + "repeat": 2, + "pool": 8, + "api_cpu_each": 2, + "api_memory_mb_each": 2048, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.14, + "concurrency": 16, + "successful_requests": 607, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 118.087, + "successful_latency_ms": { + "p50": 133.386, + "p95": 175.111, + "p99": 200.193 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-190f41a4-api-1", + "cpu_percent": "5.83%", + "memory": "75.7MiB / 2GiB" + }, + { + "name": "vp-lab3-research-190f41a4-lb-1", + "cpu_percent": "4.61%", + "memory": "20.15MiB / 128MiB" + }, + { + "name": "vp-lab3-research-190f41a4-postgres-1", + "cpu_percent": "20.12%", + "memory": "42.15MiB / 768MiB" + }, + { + "name": "vp-lab3-research-190f41a4-valkey-1", + "cpu_percent": "0.35%", + "memory": "10.84MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "Client", + "wait_event": "ClientRead", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 2 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ] + ], + "messages": 607 + }, + { + "phase": "fixed", + "replicas": 2, + "repeat": 1, + "pool": 8, + "api_cpu_each": 1, + "api_memory_mb_each": 1024, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.14, + "concurrency": 16, + "successful_requests": 600, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 116.742, + "successful_latency_ms": { + "p50": 133.445, + "p95": 258.615, + "p99": 342.106 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-190f41a4-api-1", + "cpu_percent": "3.45%", + "memory": "74.93MiB / 1GiB" + }, + { + "name": "vp-lab3-research-190f41a4-api-2", + "cpu_percent": "3.59%", + "memory": "74.41MiB / 1GiB" + }, + { + "name": "vp-lab3-research-190f41a4-lb-1", + "cpu_percent": "4.59%", + "memory": "19.89MiB / 128MiB" + }, + { + "name": "vp-lab3-research-190f41a4-postgres-1", + "cpu_percent": "27.07%", + "memory": "55.35MiB / 768MiB" + }, + { + "name": "vp-lab3-research-190f41a4-valkey-1", + "cpu_percent": "0.35%", + "memory": "11.09MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 6 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + }, + { + "wait_event_type": "LWLock", + "wait_event": "WALWrite", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 6 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ] + ], + "messages": 600 + }, + { + "phase": "fixed", + "replicas": 2, + "repeat": 2, + "pool": 8, + "api_cpu_each": 1, + "api_memory_mb_each": 1024, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.144, + "concurrency": 16, + "successful_requests": 562, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 109.247, + "successful_latency_ms": { + "p50": 133.488, + "p95": 316.996, + "p99": 375.102 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-190f41a4-api-1", + "cpu_percent": "5.08%", + "memory": "74.39MiB / 1GiB" + }, + { + "name": "vp-lab3-research-190f41a4-api-2", + "cpu_percent": "2.55%", + "memory": "72.93MiB / 1GiB" + }, + { + "name": "vp-lab3-research-190f41a4-lb-1", + "cpu_percent": "4.83%", + "memory": "20.56MiB / 128MiB" + }, + { + "name": "vp-lab3-research-190f41a4-postgres-1", + "cpu_percent": "20.81%", + "memory": "54.71MiB / 768MiB" + }, + { + "name": "vp-lab3-research-190f41a4-valkey-1", + "cpu_percent": "0.30%", + "memory": "10.6MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 5 + }, + { + "wait_event_type": "LWLock", + "wait_event": "LockManager", + "count": 1 + }, + { + "wait_event_type": null, + "wait_event": null, + "count": 2 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 6 + }, + { + "wait_event_type": null, + "wait_event": null, + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 6 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ] + ], + "messages": 562 + }, + { + "phase": "fixed", + "replicas": 4, + "repeat": 1, + "pool": 8, + "api_cpu_each": 0.5, + "api_memory_mb_each": 512, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.143, + "concurrency": 16, + "successful_requests": 602, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 117.062, + "successful_latency_ms": { + "p50": 108.454, + "p95": 333.843, + "p99": 442.317 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-190f41a4-api-1", + "cpu_percent": "1.76%", + "memory": "43.32MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-api-2", + "cpu_percent": "1.67%", + "memory": "73.35MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-api-3", + "cpu_percent": "3.91%", + "memory": "43.08MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-api-4", + "cpu_percent": "1.84%", + "memory": "73.82MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-lb-1", + "cpu_percent": "4.85%", + "memory": "20.39MiB / 128MiB" + }, + { + "name": "vp-lab3-research-190f41a4-postgres-1", + "cpu_percent": "30.32%", + "memory": "79.91MiB / 768MiB" + }, + { + "name": "vp-lab3-research-190f41a4-valkey-1", + "cpu_percent": "0.35%", + "memory": "11.36MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 13 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 13 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 12 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 13 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 13 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 11 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 13 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 14 + } + ], + [ + { + "wait_event_type": "LWLock", + "wait_event": "BufferContent", + "count": 4 + }, + { + "wait_event_type": "LWLock", + "wait_event": "LockManager", + "count": 6 + }, + { + "wait_event_type": null, + "wait_event": null, + "count": 4 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 14 + } + ] + ], + "messages": 602 + }, + { + "phase": "fixed", + "replicas": 4, + "repeat": 2, + "pool": 8, + "api_cpu_each": 0.5, + "api_memory_mb_each": 512, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.141, + "concurrency": 16, + "successful_requests": 598, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 116.32, + "successful_latency_ms": { + "p50": 108.487, + "p95": 358.782, + "p99": 475.655 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-190f41a4-api-1", + "cpu_percent": "1.82%", + "memory": "43.27MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-api-2", + "cpu_percent": "1.76%", + "memory": "43.33MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-api-3", + "cpu_percent": "2.01%", + "memory": "74.21MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-api-4", + "cpu_percent": "1.70%", + "memory": "74.55MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-lb-1", + "cpu_percent": "4.84%", + "memory": "21.06MiB / 128MiB" + }, + { + "name": "vp-lab3-research-190f41a4-postgres-1", + "cpu_percent": "25.11%", + "memory": "81.58MiB / 768MiB" + }, + { + "name": "vp-lab3-research-190f41a4-valkey-1", + "cpu_percent": "0.34%", + "memory": "11.36MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 12 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 15 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 14 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 11 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 13 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 13 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 12 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 12 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 12 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 15 + } + ] + ], + "messages": 598 + }, + { + "phase": "growing", + "replicas": 1, + "repeat": 1, + "pool": 8, + "api_cpu_each": 1, + "api_memory_mb_each": 512, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.141, + "concurrency": 16, + "successful_requests": 593, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 115.34, + "successful_latency_ms": { + "p50": 133.458, + "p95": 183.338, + "p99": 225.146 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-190f41a4-api-1", + "cpu_percent": "5.86%", + "memory": "75.58MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-lb-1", + "cpu_percent": "4.65%", + "memory": "21.32MiB / 128MiB" + }, + { + "name": "vp-lab3-research-190f41a4-postgres-1", + "cpu_percent": "20.63%", + "memory": "45.78MiB / 768MiB" + }, + { + "name": "vp-lab3-research-190f41a4-valkey-1", + "cpu_percent": "0.34%", + "memory": "11.09MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ] + ], + "messages": 593 + }, + { + "phase": "growing", + "replicas": 1, + "repeat": 2, + "pool": 8, + "api_cpu_each": 1, + "api_memory_mb_each": 512, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.149, + "concurrency": 16, + "successful_requests": 608, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 118.078, + "successful_latency_ms": { + "p50": 133.366, + "p95": 168.029, + "p99": 200.224 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-190f41a4-api-1", + "cpu_percent": "5.83%", + "memory": "76MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-lb-1", + "cpu_percent": "4.74%", + "memory": "21.44MiB / 128MiB" + }, + { + "name": "vp-lab3-research-190f41a4-postgres-1", + "cpu_percent": "22.75%", + "memory": "55.13MiB / 768MiB" + }, + { + "name": "vp-lab3-research-190f41a4-valkey-1", + "cpu_percent": "0.35%", + "memory": "10.84MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ] + ], + "messages": 608 + }, + { + "phase": "growing", + "replicas": 2, + "repeat": 1, + "pool": 8, + "api_cpu_each": 1, + "api_memory_mb_each": 512, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.15, + "concurrency": 16, + "successful_requests": 608, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 118.067, + "successful_latency_ms": { + "p50": 133.605, + "p95": 275.297, + "p99": 333.729 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-190f41a4-api-1", + "cpu_percent": "3.16%", + "memory": "73.16MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-api-2", + "cpu_percent": "5.57%", + "memory": "74.6MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-lb-1", + "cpu_percent": "4.62%", + "memory": "21.2MiB / 128MiB" + }, + { + "name": "vp-lab3-research-190f41a4-postgres-1", + "cpu_percent": "21.94%", + "memory": "57.85MiB / 768MiB" + }, + { + "name": "vp-lab3-research-190f41a4-valkey-1", + "cpu_percent": "0.36%", + "memory": "10.85MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 6 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 6 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 6 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 5 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ] + ], + "messages": 608 + }, + { + "phase": "growing", + "replicas": 2, + "repeat": 2, + "pool": 8, + "api_cpu_each": 1, + "api_memory_mb_each": 512, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.167, + "concurrency": 16, + "successful_requests": 608, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 117.681, + "successful_latency_ms": { + "p50": 133.469, + "p95": 241.935, + "p99": 300.372 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-190f41a4-api-1", + "cpu_percent": "5.43%", + "memory": "73.93MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-api-2", + "cpu_percent": "3.43%", + "memory": "72.4MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-lb-1", + "cpu_percent": "4.81%", + "memory": "21.37MiB / 128MiB" + }, + { + "name": "vp-lab3-research-190f41a4-postgres-1", + "cpu_percent": "22.32%", + "memory": "58.33MiB / 768MiB" + }, + { + "name": "vp-lab3-research-190f41a4-valkey-1", + "cpu_percent": "0.35%", + "memory": "11.09MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 7 + } + ] + ], + "messages": 608 + }, + { + "phase": "growing", + "replicas": 4, + "repeat": 1, + "pool": 8, + "api_cpu_each": 1, + "api_memory_mb_each": 512, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.15, + "concurrency": 16, + "successful_requests": 605, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 117.487, + "successful_latency_ms": { + "p50": 105.327, + "p95": 342.192, + "p99": 467.389 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-190f41a4-api-1", + "cpu_percent": "1.70%", + "memory": "42.57MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-api-2", + "cpu_percent": "3.77%", + "memory": "40.77MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-api-3", + "cpu_percent": "1.73%", + "memory": "73.8MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-api-4", + "cpu_percent": "1.75%", + "memory": "71.06MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-lb-1", + "cpu_percent": "4.86%", + "memory": "21.67MiB / 128MiB" + }, + { + "name": "vp-lab3-research-190f41a4-postgres-1", + "cpu_percent": "25.45%", + "memory": "82MiB / 768MiB" + }, + { + "name": "vp-lab3-research-190f41a4-valkey-1", + "cpu_percent": "0.33%", + "memory": "11.36MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 13 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 13 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 13 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 12 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 13 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 14 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 13 + } + ], + [ + { + "wait_event_type": "Client", + "wait_event": "ClientRead", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 11 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 14 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 14 + } + ] + ], + "messages": 605 + }, + { + "phase": "growing", + "replicas": 4, + "repeat": 2, + "pool": 8, + "api_cpu_each": 1, + "api_memory_mb_each": 512, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.151, + "concurrency": 16, + "successful_requests": 601, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 116.686, + "successful_latency_ms": { + "p50": 100.22, + "p95": 342.158, + "p99": 525.685 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-190f41a4-api-1", + "cpu_percent": "3.80%", + "memory": "43.45MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-api-2", + "cpu_percent": "3.80%", + "memory": "73.02MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-api-3", + "cpu_percent": "1.98%", + "memory": "73.09MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-api-4", + "cpu_percent": "1.71%", + "memory": "43.09MiB / 512MiB" + }, + { + "name": "vp-lab3-research-190f41a4-lb-1", + "cpu_percent": "4.80%", + "memory": "21.9MiB / 128MiB" + }, + { + "name": "vp-lab3-research-190f41a4-postgres-1", + "cpu_percent": "25.03%", + "memory": "80.56MiB / 768MiB" + }, + { + "name": "vp-lab3-research-190f41a4-valkey-1", + "cpu_percent": "0.35%", + "memory": "11.12MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 13 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 13 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 13 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 14 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 13 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 14 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 11 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 13 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 15 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 14 + } + ] + ], + "messages": 601 + }, + { + "phase": "pool", + "replicas": 1, + "repeat": 1, + "pool": 1, + "api_cpu_each": 2, + "api_memory_mb_each": 2048, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.147, + "concurrency": 16, + "successful_requests": 611, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 118.702, + "successful_latency_ms": { + "p50": 133.434, + "p95": 134.637, + "p99": 166.743 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-190f41a4-api-1", + "cpu_percent": "5.90%", + "memory": "75.44MiB / 2GiB" + }, + { + "name": "vp-lab3-research-190f41a4-lb-1", + "cpu_percent": "4.68%", + "memory": "22.25MiB / 128MiB" + }, + { + "name": "vp-lab3-research-190f41a4-postgres-1", + "cpu_percent": "22.01%", + "memory": "38.18MiB / 768MiB" + }, + { + "name": "vp-lab3-research-190f41a4-valkey-1", + "cpu_percent": "0.31%", + "memory": "11.07MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ] + ], + "messages": 611 + }, + { + "phase": "pool", + "replicas": 1, + "repeat": 2, + "pool": 1, + "api_cpu_each": 2, + "api_memory_mb_each": 2048, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.138, + "concurrency": 16, + "successful_requests": 609, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 118.536, + "successful_latency_ms": { + "p50": 133.439, + "p95": 141.77, + "p99": 166.75 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-190f41a4-api-1", + "cpu_percent": "5.97%", + "memory": "75.16MiB / 2GiB" + }, + { + "name": "vp-lab3-research-190f41a4-lb-1", + "cpu_percent": "4.68%", + "memory": "22.19MiB / 128MiB" + }, + { + "name": "vp-lab3-research-190f41a4-postgres-1", + "cpu_percent": "22.38%", + "memory": "37.95MiB / 768MiB" + }, + { + "name": "vp-lab3-research-190f41a4-valkey-1", + "cpu_percent": "0.31%", + "memory": "10.84MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ] + ], + "messages": 609 + }, + { + "phase": "pool", + "replicas": 1, + "repeat": 1, + "pool": 8, + "api_cpu_each": 2, + "api_memory_mb_each": 2048, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.157, + "concurrency": 16, + "successful_requests": 536, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 103.939, + "successful_latency_ms": { + "p50": 133.518, + "p95": 308.743, + "p99": 458.453 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-190f41a4-api-1", + "cpu_percent": "5.61%", + "memory": "75.92MiB / 2GiB" + }, + { + "name": "vp-lab3-research-190f41a4-lb-1", + "cpu_percent": "4.57%", + "memory": "22.37MiB / 128MiB" + }, + { + "name": "vp-lab3-research-190f41a4-postgres-1", + "cpu_percent": "19.84%", + "memory": "47.76MiB / 768MiB" + }, + { + "name": "vp-lab3-research-190f41a4-valkey-1", + "cpu_percent": "0.36%", + "memory": "10.6MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 2 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ] + ], + "messages": 536 + }, + { + "phase": "pool", + "replicas": 1, + "repeat": 2, + "pool": 8, + "api_cpu_each": 2, + "api_memory_mb_each": 2048, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.141, + "concurrency": 16, + "successful_requests": 584, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 113.604, + "successful_latency_ms": { + "p50": 133.411, + "p95": 200.205, + "p99": 283.495 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-190f41a4-api-1", + "cpu_percent": "5.82%", + "memory": "75.2MiB / 2GiB" + }, + { + "name": "vp-lab3-research-190f41a4-lb-1", + "cpu_percent": "4.85%", + "memory": "22.94MiB / 128MiB" + }, + { + "name": "vp-lab3-research-190f41a4-postgres-1", + "cpu_percent": "20.08%", + "memory": "47.43MiB / 768MiB" + }, + { + "name": "vp-lab3-research-190f41a4-valkey-1", + "cpu_percent": "0.35%", + "memory": "11.34MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 2 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 2 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ] + ], + "messages": 584 + } + ], + "rolling": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 30, + "elapsed_seconds": 30.067, + "concurrency": 8, + "successful_requests": 2684, + "failed_requests": 46, + "error_ratio": 0.01685, + "successful_rps": 89.267, + "successful_latency_ms": { + "p50": 58.444, + "p95": 217.042, + "p99": 544.068 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + } +} diff --git a/evidence/research/run-sB0hdP/hardware.json b/evidence/research/run-sB0hdP/hardware.json new file mode 100644 index 00000000..9754312b --- /dev/null +++ b/evidence/research/run-sB0hdP/hardware.json @@ -0,0 +1,30 @@ +[ + { + "field": "CPU(s):", + "data": "16" + }, + { + "field": "On-line CPU(s) list:", + "data": "0-15" + }, + { + "field": "Model name:", + "data": "AMD Ryzen 7 5700X 8-Core Processor" + }, + { + "field": "Thread(s) per core:", + "data": "2" + }, + { + "field": "Core(s) per socket:", + "data": "8" + }, + { + "field": "CPU(s) scaling MHz:", + "data": "85%" + }, + { + "field": "NUMA node0 CPU(s):", + "data": "0-15" + } +] diff --git a/evidence/research/run-sB0hdP/pool-1-1-2.json b/evidence/research/run-sB0hdP/pool-1-1-2.json new file mode 100644 index 00000000..cb9808d0 --- /dev/null +++ b/evidence/research/run-sB0hdP/pool-1-1-2.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.138, + "concurrency": 16, + "successful_requests": 610, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 118.725, + "successful_latency_ms": { + "p50": 133.434, + "p95": 133.604, + "p99": 166.758 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-sB0hdP/pool-1-1-3.json b/evidence/research/run-sB0hdP/pool-1-1-3.json new file mode 100644 index 00000000..528858ab --- /dev/null +++ b/evidence/research/run-sB0hdP/pool-1-1-3.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.139, + "concurrency": 16, + "successful_requests": 608, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 118.312, + "successful_latency_ms": { + "p50": 133.441, + "p95": 158.342, + "p99": 158.46 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-sB0hdP/pool-1-8-1.json b/evidence/research/run-sB0hdP/pool-1-8-1.json new file mode 100644 index 00000000..9eb978d1 --- /dev/null +++ b/evidence/research/run-sB0hdP/pool-1-8-1.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.149, + "concurrency": 16, + "successful_requests": 605, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 117.493, + "successful_latency_ms": { + "p50": 133.42, + "p95": 166.87, + "p99": 200.216 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-sB0hdP/pool-1-8-4.json b/evidence/research/run-sB0hdP/pool-1-8-4.json new file mode 100644 index 00000000..9928eff3 --- /dev/null +++ b/evidence/research/run-sB0hdP/pool-1-8-4.json @@ -0,0 +1,17 @@ +{ + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5.0, + "elapsed_seconds": 5.149, + "concurrency": 16, + "successful_requests": 608, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 118.075, + "successful_latency_ms": { + "p50": 133.445, + "p95": 166.842, + "p99": 183.626 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/research/run-sB0hdP/run.json b/evidence/research/run-sB0hdP/run.json new file mode 100644 index 00000000..8d544533 --- /dev/null +++ b/evidence/research/run-sB0hdP/run.json @@ -0,0 +1 @@ +{"run_id":"2d3ae773","started_at":"2026-11-12T13:27:42.020Z","state":"started","project":"vp-lab3-research-2d3ae773"} diff --git a/evidence/research/run-sB0hdP/summary.json b/evidence/research/run-sB0hdP/summary.json new file mode 100644 index 00000000..0c183879 --- /dev/null +++ b/evidence/research/run-sB0hdP/summary.json @@ -0,0 +1,578 @@ +{ + "run_id": "2d3ae773", + "valid": true, + "complete": true, + "expected_samples": 4, + "profile": "closed-loop POST text, concurrency16,5seconds,2repetitions; fresh DB data for each run", + "samples": [ + { + "phase": "pool", + "replicas": 1, + "repeat": 1, + "pool": 8, + "api_cpu_each": 2, + "api_memory_mb_each": 2048, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.149, + "concurrency": 16, + "successful_requests": 605, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 117.493, + "successful_latency_ms": { + "p50": 133.42, + "p95": 166.87, + "p99": 200.216 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-2d3ae773-api-1", + "cpu_percent": "8.11%", + "memory": "75.05MiB / 2GiB" + }, + { + "name": "vp-lab3-research-2d3ae773-lb-1", + "cpu_percent": "4.56%", + "memory": "18.96MiB / 128MiB" + }, + { + "name": "vp-lab3-research-2d3ae773-postgres-1", + "cpu_percent": "20.26%", + "memory": "42.62MiB / 768MiB" + }, + { + "name": "vp-lab3-research-2d3ae773-valkey-1", + "cpu_percent": "0.35%", + "memory": "10.83MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 2 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 2 + }, + { + "wait_event_type": null, + "wait_event": null, + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ] + ], + "messages": 605 + }, + { + "phase": "pool", + "replicas": 1, + "repeat": 2, + "pool": 1, + "api_cpu_each": 2, + "api_memory_mb_each": 2048, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.138, + "concurrency": 16, + "successful_requests": 610, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 118.725, + "successful_latency_ms": { + "p50": 133.434, + "p95": 133.604, + "p99": 166.758 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-2d3ae773-api-1", + "cpu_percent": "5.89%", + "memory": "75.96MiB / 2GiB" + }, + { + "name": "vp-lab3-research-2d3ae773-lb-1", + "cpu_percent": "4.76%", + "memory": "20.63MiB / 128MiB" + }, + { + "name": "vp-lab3-research-2d3ae773-postgres-1", + "cpu_percent": "22.08%", + "memory": "32.66MiB / 768MiB" + }, + { + "name": "vp-lab3-research-2d3ae773-valkey-1", + "cpu_percent": "0.32%", + "memory": "11.58MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ] + ], + "messages": 610 + }, + { + "phase": "pool", + "replicas": 1, + "repeat": 3, + "pool": 1, + "api_cpu_each": 2, + "api_memory_mb_each": 2048, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.139, + "concurrency": 16, + "successful_requests": 608, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 118.312, + "successful_latency_ms": { + "p50": 133.441, + "p95": 158.342, + "p99": 158.46 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-2d3ae773-api-1", + "cpu_percent": "5.92%", + "memory": "75.91MiB / 2GiB" + }, + { + "name": "vp-lab3-research-2d3ae773-lb-1", + "cpu_percent": "4.64%", + "memory": "19.86MiB / 128MiB" + }, + { + "name": "vp-lab3-research-2d3ae773-postgres-1", + "cpu_percent": "18.14%", + "memory": "32.81MiB / 768MiB" + }, + { + "name": "vp-lab3-research-2d3ae773-valkey-1", + "cpu_percent": "0.32%", + "memory": "11.08MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + } + ] + ], + "messages": 608 + }, + { + "phase": "pool", + "replicas": 1, + "repeat": 4, + "pool": 8, + "api_cpu_each": 2, + "api_memory_mb_each": 2048, + "metrics": { + "lab": 3, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 5, + "elapsed_seconds": 5.149, + "concurrency": 16, + "successful_requests": 608, + "failed_requests": 0, + "error_ratio": 0, + "successful_rps": 118.075, + "successful_latency_ms": { + "p50": 133.445, + "p95": 166.842, + "p99": 183.626 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." + }, + "snapshot": [ + { + "name": "vp-lab3-research-2d3ae773-api-1", + "cpu_percent": "5.86%", + "memory": "75.98MiB / 2GiB" + }, + { + "name": "vp-lab3-research-2d3ae773-lb-1", + "cpu_percent": "4.73%", + "memory": "20.56MiB / 128MiB" + }, + { + "name": "vp-lab3-research-2d3ae773-postgres-1", + "cpu_percent": "24.58%", + "memory": "43.39MiB / 768MiB" + }, + { + "name": "vp-lab3-research-2d3ae773-valkey-1", + "cpu_percent": "0.36%", + "memory": "11.07MiB / 128MiB" + } + ], + "postgres_wait_samples": [ + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 2 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "Client", + "wait_event": "ClientRead", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 2 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ], + [ + { + "wait_event_type": "IO", + "wait_event": "WalSync", + "count": 1 + }, + { + "wait_event_type": "Lock", + "wait_event": "transactionid", + "count": 3 + } + ] + ], + "messages": 608 + } + ] +} diff --git a/evidence/restart-after.txt b/evidence/restart-after.txt new file mode 100644 index 00000000..092277f1 --- /dev/null +++ b/evidence/restart-after.txt @@ -0,0 +1,4 @@ +/vp-lab3-medvedev-api-1 6c0ae312beb4c7f01563017b251071e87077311286f47a8f170994ab2e749b93 2026-11-12T13:56:02.234536913Z +/vp-lab3-medvedev-api-2 b6fc46f48e22de08af35b52a7b0e64098ef225d6a15c18633991f19e5a5233d5 2026-11-12T13:56:02.653460687Z +/vp-lab3-medvedev-postgres-1 8fea895f6a75e831da342ad6cece8b58032263fd7ff0efefaf63de0f5670d70a 2026-11-12T13:56:04.50115397Z +/vp-lab3-medvedev-valkey-1 eda0fd43f7830b8ce803dd111c6557b6726512ac9515e831750ea6f36fef9063 2026-11-12T13:56:03.303256383Z diff --git a/evidence/restart-before.txt b/evidence/restart-before.txt new file mode 100644 index 00000000..e3a20798 --- /dev/null +++ b/evidence/restart-before.txt @@ -0,0 +1,4 @@ +/vp-lab3-medvedev-api-1 6c0ae312beb4c7f01563017b251071e87077311286f47a8f170994ab2e749b93 2026-11-12T13:55:53.95860066Z +/vp-lab3-medvedev-api-2 b6fc46f48e22de08af35b52a7b0e64098ef225d6a15c18633991f19e5a5233d5 2026-11-12T13:55:54.568130414Z +/vp-lab3-medvedev-postgres-1 8fea895f6a75e831da342ad6cece8b58032263fd7ff0efefaf63de0f5670d70a 2026-11-12T12:17:47.662275075Z +/vp-lab3-medvedev-valkey-1 eda0fd43f7830b8ce803dd111c6557b6726512ac9515e831750ea6f36fef9063 2026-11-12T12:17:46.514207433Z diff --git a/evidence/smoke.txt b/evidence/smoke.txt new file mode 100644 index 00000000..2fc9607a --- /dev/null +++ b/evidence/smoke.txt @@ -0,0 +1,2 @@ +/mnt/data/home/bench-saves/vp-labs-vuIKezo9/lab3/.venv/bin/python tests/smoke.py --base-url "http://127.0.0.1:28203" +PASS: lab3 public API scenario; infrastructure and grading evidence remain separate. diff --git a/evidence/stop-one-after.txt b/evidence/stop-one-after.txt new file mode 100644 index 00000000..e9ce20e9 --- /dev/null +++ b/evidence/stop-one-after.txt @@ -0,0 +1 @@ +/vp-lab3-medvedev-api-1 983d4caaa12e4990078462933b0e5a7f26a0c405ad9339be52d5160eb4f986ed false diff --git a/evidence/stop-one-before.txt b/evidence/stop-one-before.txt new file mode 100644 index 00000000..576603c5 --- /dev/null +++ b/evidence/stop-one-before.txt @@ -0,0 +1 @@ +/vp-lab3-medvedev-api-1 983d4caaa12e4990078462933b0e5a7f26a0c405ad9339be52d5160eb4f986ed true diff --git a/evidence/stopped-1.txt b/evidence/stopped-1.txt new file mode 100644 index 00000000..54db0e22 --- /dev/null +++ b/evidence/stopped-1.txt @@ -0,0 +1 @@ +/vp-lab3-medvedev-api-2 e133a269f7a480f264ac13d075f65c8dca7250d5903b6076015b0dc285d7cb1f false diff --git a/evidence/stopped-2.txt b/evidence/stopped-2.txt new file mode 100644 index 00000000..e9ce20e9 --- /dev/null +++ b/evidence/stopped-2.txt @@ -0,0 +1 @@ +/vp-lab3-medvedev-api-1 983d4caaa12e4990078462933b0e5a7f26a0c405ad9339be52d5160eb4f986ed false diff --git a/evidence/validate.txt b/evidence/validate.txt new file mode 100644 index 00000000..2bd96be1 --- /dev/null +++ b/evidence/validate.txt @@ -0,0 +1,2 @@ +/mnt/data/home/bench-saves/vp-labs-vuIKezo9/lab3/.venv/bin/python scripts/validate_openapi.py +PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested. diff --git a/evidence/validation-dependencies.txt b/evidence/validation-dependencies.txt new file mode 100644 index 00000000..3e49340b --- /dev/null +++ b/evidence/validation-dependencies.txt @@ -0,0 +1,59 @@ +Collecting openapi-spec-validator==0.7.2 (from -r requirements-dev.txt (line 2)) + Using cached openapi_spec_validator-0.7.2-py3-none-any.whl.metadata (5.7 kB) +Collecting jsonschema<5.0.0,>=4.18.0 (from openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached jsonschema-4.26.0-py3-none-any.whl.metadata (7.6 kB) +Collecting jsonschema-path<0.4.0,>=0.3.1 (from openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached jsonschema_path-0.3.4-py3-none-any.whl.metadata (4.3 kB) +Collecting lazy-object-proxy<2.0.0,>=1.7.1 (from openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached lazy_object_proxy-1.13.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (5.1 kB) +Collecting openapi-schema-validator<0.7.0,>=0.6.0 (from openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached openapi_schema_validator-0.6.3-py3-none-any.whl.metadata (5.4 kB) +Collecting attrs>=22.2.0 (from jsonschema<5.0.0,>=4.18.0->openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached attrs-26.1.0-py3-none-any.whl.metadata (8.8 kB) +Collecting jsonschema-specifications>=2023.03.6 (from jsonschema<5.0.0,>=4.18.0->openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached jsonschema_specifications-2025.9.1-py3-none-any.whl.metadata (2.9 kB) +Collecting referencing>=0.28.4 (from jsonschema<5.0.0,>=4.18.0->openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached referencing-0.37.0-py3-none-any.whl.metadata (2.8 kB) +Collecting rpds-py>=0.25.0 (from jsonschema<5.0.0,>=4.18.0->openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.1 kB) +Collecting PyYAML>=5.1 (from jsonschema-path<0.4.0,>=0.3.1->openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached pyyaml-6.0.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.metadata (2.4 kB) +Collecting pathable<0.5.0,>=0.4.1 (from jsonschema-path<0.4.0,>=0.3.1->openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached pathable-0.4.4-py3-none-any.whl.metadata (1.8 kB) +Collecting referencing>=0.28.4 (from jsonschema<5.0.0,>=4.18.0->openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached referencing-0.36.2-py3-none-any.whl.metadata (2.8 kB) +Collecting requests<3.0.0,>=2.31.0 (from jsonschema-path<0.4.0,>=0.3.1->openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached requests-2.34.2-py3-none-any.whl.metadata (4.8 kB) +Collecting rfc3339-validator (from openapi-schema-validator<0.7.0,>=0.6.0->openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached rfc3339_validator-0.1.4-py2.py3-none-any.whl.metadata (1.5 kB) +Collecting charset_normalizer<4,>=2 (from requests<3.0.0,>=2.31.0->jsonschema-path<0.4.0,>=0.3.1->openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached charset_normalizer-3.5.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.metadata (46 kB) +Collecting idna<4,>=2.5 (from requests<3.0.0,>=2.31.0->jsonschema-path<0.4.0,>=0.3.1->openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached idna-3.20-py3-none-any.whl.metadata (7.2 kB) +Collecting urllib3<3,>=1.26 (from requests<3.0.0,>=2.31.0->jsonschema-path<0.4.0,>=0.3.1->openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached urllib3-2.8.0-py3-none-any.whl.metadata (7.4 kB) +Collecting certifi>=2023.5.7 (from requests<3.0.0,>=2.31.0->jsonschema-path<0.4.0,>=0.3.1->openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached certifi-2026.10.23-py3-none-any.whl.metadata (2.5 kB) +Collecting six (from rfc3339-validator->openapi-schema-validator<0.7.0,>=0.6.0->openapi-spec-validator==0.7.2->-r requirements-dev.txt (line 2)) + Using cached six-1.17.0-py2.py3-none-any.whl.metadata (1.7 kB) +Using cached openapi_spec_validator-0.7.2-py3-none-any.whl (39 kB) +Using cached jsonschema-4.26.0-py3-none-any.whl (90 kB) +Using cached jsonschema_path-0.3.4-py3-none-any.whl (14 kB) +Using cached lazy_object_proxy-1.13.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (70 kB) +Using cached openapi_schema_validator-0.6.3-py3-none-any.whl (8.8 kB) +Using cached pathable-0.4.4-py3-none-any.whl (9.6 kB) +Using cached referencing-0.36.2-py3-none-any.whl (26 kB) +Using cached requests-2.34.2-py3-none-any.whl (73 kB) +Using cached charset_normalizer-3.5.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (255 kB) +Using cached idna-3.20-py3-none-any.whl (69 kB) +Using cached urllib3-2.8.0-py3-none-any.whl (135 kB) +Using cached attrs-26.1.0-py3-none-any.whl (67 kB) +Using cached certifi-2026.10.23-py3-none-any.whl (135 kB) +Using cached jsonschema_specifications-2025.9.1-py3-none-any.whl (18 kB) +Using cached pyyaml-6.0.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (794 kB) +Using cached rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (371 kB) +Using cached rfc3339_validator-0.1.4-py2.py3-none-any.whl (3.5 kB) +Using cached six-1.17.0-py2.py3-none-any.whl (11 kB) +Installing collected packages: urllib3, six, rpds-py, PyYAML, pathable, lazy-object-proxy, idna, charset_normalizer, certifi, attrs, rfc3339-validator, requests, referencing, jsonschema-specifications, jsonschema-path, jsonschema, openapi-schema-validator, openapi-spec-validator + +Successfully installed PyYAML-6.0.3 attrs-26.1.0 certifi-2026.10.23 charset_normalizer-3.5.2 idna-3.20 jsonschema-4.26.0 jsonschema-path-0.3.4 jsonschema-specifications-2025.9.1 lazy-object-proxy-1.13.0 openapi-schema-validator-0.6.3 openapi-spec-validator-0.7.2 pathable-0.4.4 referencing-0.36.2 requests-2.34.2 rfc3339-validator-0.1.4 rpds-py-2026.9.1 six-1.17.0 urllib3-2.8.0 diff --git a/scripts/bootstrap.ts b/scripts/bootstrap.ts new file mode 100644 index 00000000..017e3de0 --- /dev/null +++ b/scripts/bootstrap.ts @@ -0,0 +1,22 @@ +import { mkdir, writeFile, chmod, access } from 'node:fs/promises'; +import { resolve } from 'node:path'; + +const root = resolve(import.meta.dir, '..'); +const local = resolve(root, '.local'); +const files = ['pg_password', 'database_url', 'cache_url', 'valkey.conf']; +const present = await Promise.all(files.map(async name => {try {await access(resolve(local, name));return true;} catch {return false;}})); +if (present.some(Boolean)) { + if (!present.every(Boolean)) throw new Error('Incomplete local configuration; preserve it and investigate before bootstrap'); + console.log('Local configuration exists'); +} else { + await mkdir(local, { recursive: true, mode: 0o700 }); + const pg = crypto.randomUUID().replaceAll('-', '') + crypto.randomUUID().replaceAll('-', ''); + const cache = crypto.randomUUID().replaceAll('-', ''); + const values = [pg, `postgres://messenger:${pg}@postgres:5432/messenger?sslmode=disable`, `redis://:${cache}@valkey:6379/0`, `bind 0.0.0.0\nprotected-mode yes\nrequirepass ${cache}\nappendonly yes\nappendfsync always\ndir /data\n`]; + for (let i = 0; i < files.length; i++) { + const destination = resolve(local, files[i]); + await writeFile(destination, values[i] + '\n', { mode: 0o600, flag: 'wx' }); + await chmod(destination, 0o644); // Compose secrets must be readable by nonroot containers; parent is 0700. + } + console.log('Created local synthetic stand credentials'); +} diff --git a/scripts/compose.sh b/scripts/compose.sh new file mode 100755 index 00000000..f1a72af1 --- /dev/null +++ b/scripts/compose.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +ROOT=$(cd "$(dirname "$0")/.." && pwd) +exec docker compose --project-directory "$ROOT" -f "$ROOT/compose.yaml" -p vp-lab3-medvedev "$@" diff --git a/scripts/k3s-model.ts b/scripts/k3s-model.ts new file mode 100644 index 00000000..6f7d67ee --- /dev/null +++ b/scripts/k3s-model.ts @@ -0,0 +1,166 @@ +export function settings( + lab: number, + env: Record = {}, +) { + if (lab !== 3 && lab !== 4) + throw new Error("Only labs3 and4 use this runtime"); + const cluster = env.VP_CLUSTER ?? `vp-lab${lab}-medvedev`, + port = Number(env.PUBLIC_PORT ?? 28200 + lab); + if (!new RegExp(`^vp-lab${lab}-(medvedev|r-[a-f0-9]{8})$`).test(cluster)) + throw new Error("Unapproved cluster name"); + if (!Number.isInteger(port) || port < 1024 || port > 65535) + throw new Error("Invalid public port"); + return { lab, cluster, port, namespace: "messenger" }; +} +export function assertOwned(receipt: any, actual: any, expected: any): void { + if ( + !receipt || + receipt.lab !== expected.lab || + receipt.cluster !== expected.cluster || + !receipt.container || + receipt.container !== actual.container || + !receipt.namespaceUID || + receipt.namespaceUID !== actual.namespaceUID + ) + throw new Error("Cluster or namespace ownership guard failed"); +} +export function guardedOperator( + expected: any, + ports: { + receipt: () => Promise; + actual: () => Promise; + dispatch: (action: string) => Promise; + }, +) { + return { + async run(action: string) { + const [receipt, actual] = await Promise.all([ + ports.receipt(), + ports.actual(), + ]); + assertOwned(receipt, actual, expected); + return ports.dispatch(action); + }, + }; +} +export function pinnedConfigID(image: any, source: string): string { + const [tagged, digest] = source.split("@"); + const repository = tagged.replace(/:[^/:]+$/, ""); + if ( + !digest || + !image?.Id || + !image.RepoDigests?.some( + (ref: string) => + ref.replace(/^docker\.io\//, "").replace(/^library\//, "") === + repository + "@" + digest, + ) + ) + throw new Error("Pinned manifest identity differs"); + return image.Id; +} +export function assertScopedArgs(args: string[]): void { + const end = args.indexOf("--"), + flags = end < 0 ? args : args.slice(0, end); + if (end >= 0 && args[0] !== "exec") + throw new Error("Only exec accepts an application command delimiter"); + if ( + flags.some((x) => + /^(-A$|-n|-s|--(?:all-namespaces|namespace|context|kubeconfig|server|token|user|cluster|as|as-group|raw)(?:=|$))/.test( + x, + ), + ) + ) + throw new Error("Target override rejected"); + const allowed = + /^(pods?|deployments?|deploy|jobs?|services?|svc|persistentvolumeclaims?|pvc|configmaps?|events?)(\/[^,]+)?$/; + if ( + ![ + "get", + "exec", + "logs", + "rollout", + "scale", + "annotate", + "wait", + "top", + ].includes(args[0]) + ) + throw new Error("Unsupported scoped verb"); + const resource = + args[0] === "rollout" + ? args[2] + : ["wait", "exec"].includes(args[0]) + ? flags.find((x) => allowed.test(x)) + : args[1]; + if (!resource || !resource.split(",").every((x) => allowed.test(x))) + throw new Error("Only approved namespaced resources are supported"); + if ( + flags.some( + (x) => + (!x.startsWith("-") && x.includes("/") && !allowed.test(x)) || + /^(?:-f|--filename|-k|--kustomize)(?:=|$)/.test(x), + ) + ) + throw new Error("Additional resource override rejected"); +} +export function assertNoGame(code: number) { + if (code !== 1) + throw new Error( + "Measurement requires an inactive game with confirmed status", + ); +} +export function assertPartialClaim(receipt: any, server: any, expected: any) { + if ( + receipt?.state !== "claimed" || + receipt.lab !== expected.lab || + receipt.cluster !== expected.cluster || + !receipt.nonce || + server.owner !== receipt.nonce || + !server.container || + (receipt.container && receipt.container !== server.container) + ) + throw new Error("Partial cluster claim differs"); +} +export function assertNoRunningContainers( + containers: any[], + podUID: string, +): void { + if (containers.some((c) => c.labels?.["io.kubernetes.pod.uid"] === podUID)) + throw new Error("A victim Pod process is still running"); +} +export async function withCleanup(ports: { + perform: () => Promise; + cleanup: () => Promise; +}): Promise { + let result!: T; + let failure: unknown; + let failed = false; + try { + result = await ports.perform(); + } catch (error) { + failure = error; + failed = true; + } + try { + await ports.cleanup(); + } catch (error) { + if (failed) + throw new AggregateError( + [failure, error], + (failure instanceof Error ? failure.message : "Operation failed") + + "; cleanup failed", + { cause: failure }, + ); + throw error; + } + if (failed) throw failure; + return result; +} +export function assertImageBudget( + lab: number, + mib: number, + soft: string, +): void { + if (lab === 4 && (mib !== 2048 || soft !== "1536MiB")) + throw new Error("Lab4 requires its verified 2Gi/1536MiB decoder budget"); +} diff --git a/scripts/k3s.ts b/scripts/k3s.ts new file mode 100644 index 00000000..c13b9ee3 --- /dev/null +++ b/scripts/k3s.ts @@ -0,0 +1,1179 @@ +import { mkdir, readFile, readdir, writeFile, rm } from "node:fs/promises"; +import { resolve, relative } from "node:path"; +import { + settings, + guardedOperator, + pinnedConfigID, + assertScopedArgs, + assertNoGame, + assertPartialClaim, + assertNoRunningContainers, + withCleanup, + assertImageBudget, +} from "./k3s-model"; + +const root = resolve(import.meta.dir, ".."); +const lab = (await Bun.file(resolve(root, "lab.json")).json()).number; +const cfg = settings(lab, process.env); +const local = resolve(root, ".local/k3s", cfg.cluster), + kubeconfig = resolve(local, "kubeconfig"), + receiptFile = resolve(local, "receipt.json"); +const evidence = resolve(root, "evidence/k3s"); +await mkdir(local, { recursive: true, mode: 0o700 }); +await mkdir(evidence, { recursive: true }); +const action = process.argv[2] ?? "ready"; +const args = process.argv.slice(3); +let stage = "start"; +async function command( + label: string, + argv: string[], + input?: string, + timeout = 240000, +) { + stage = label; + const p = Bun.spawn(argv, { + cwd: root, + stdin: input === undefined ? "ignore" : "pipe", + stdout: "pipe", + stderr: "pipe", + signal: AbortSignal.timeout(timeout), + }); + if (input !== undefined) { + p.stdin.write(input); + p.stdin.end(); + } + const [out, err] = await Promise.all([ + new Response(p.stdout).text(), + new Response(p.stderr).text(), + ]); + if ((await p.exited) !== 0) { + await writeFile(resolve(local, "last-error.txt"), out + err, { + mode: 0o600, + }); + throw new Error(label + " failed; private diagnostics in .local/k3s"); + } + return out; +} +function k(argv: string[], input?: string) { + return command( + "kubernetes_" + argv[0], + [ + "kubectl", + "--kubeconfig", + kubeconfig, + "--context", + "k3d-" + cfg.cluster, + "--namespace", + cfg.namespace, + ...argv, + ], + input, + ); +} +async function receipt() { + return Bun.file(receiptFile).json(); +} +async function save(r: any) { + await writeFile(receiptFile, JSON.stringify(r) + "\n", { mode: 0o600 }); +} +async function serverID() { + return ( + await command("server_identity", [ + "docker", + "inspect", + "--format", + "{{.Id}}", + "k3d-" + cfg.cluster + "-server-0", + ]) + ).trim(); +} +async function namespace() { + const out = await k([ + "get", + "namespace", + cfg.namespace, + "--ignore-not-found", + "-o", + "json", + ]); + return out.trim() ? JSON.parse(out) : undefined; +} +async function actual() { + return { + container: await serverID(), + namespaceUID: (await namespace())?.metadata?.uid, + }; +} +const operator = guardedOperator(cfg, { + receipt, + actual, + dispatch: async () => execute(), +}); +const sources = { + postgres: + "postgres:18.6@sha256:74935e72241653ca55e0414067e6d8763aceb8a810eb51b452253ec3dcfc4336", + valkey: + "valkey/valkey:9@sha256:418652cfb58ef879d4978c33553735d7147016032d5aefaa14c828e611eb9dfd", + pingap: + "vicanso/pingap:0.16.0@sha256:e5b6f38a946e3105e0d98271be95e4a2dca0441f7962efcfd30371a3b55405e7", + ...(lab === 4 + ? { + s3: "rustfs/rustfs:1.0.0-rc.1@sha256:f53d700fc16809070326f6ab3fb565d48e722364a7bd5a12e47d0a5abe079ce6", + } + : {}), +}; +async function imageSet() { + const hash = new Bun.CryptoHasher("sha256"); + hash.update(await Bun.file(resolve(root, "Dockerfile")).arrayBuffer()); + async function walk(dir: string) { + for (const item of (await readdir(dir, { withFileTypes: true })).sort( + (a, b) => a.name.localeCompare(b.name), + )) { + if (item.name.startsWith(".local")) continue; + const file = resolve(dir, item.name); + if (item.isDirectory()) await walk(file); + else if (item.isFile()) { + hash.update(file.slice(root.length)); + hash.update(await readFile(file)); + } + } + } + await walk(resolve(root, "backend")); + const version = hash.digest("hex").slice(0, 16), + api = `vp-coursework/api-lab${lab}:${version}`; + await command("build_api", ["docker", "build", "-t", api, "."]); + const images: Record = { api }; + const cached = new Set( + ( + await command("local_image_inventory", [ + "docker", + "image", + "ls", + "--digests", + "--format", + "{{.Repository}}@{{.Digest}}", + ]) + ) + .trim() + .split("\n") + .map((ref) => ref.replace(/^docker\.io\//, "").replace(/^library\//, "")), + ); + for (const [name, source] of Object.entries(sources)) { + const digest = source!.split("@sha256:")[1], + alias = `vp-coursework/${name}:${digest.slice(0, 16)}`; + const repository = source!.split("@")[0].replace(/:[^/:]+$/, ""); + if (!cached.has(repository + "@sha256:" + digest)) + await command("pull_pinned_image_" + name, ["docker", "pull", source!]); + const pinned = JSON.parse( + await command("verify_image_" + name, [ + "docker", + "image", + "inspect", + source!, + ]), + ); + const configID = pinnedConfigID(pinned[0], source!); + await command("alias_image_" + name, ["docker", "tag", source!, alias]); + if ( + ( + await command("verify_alias_" + name, [ + "docker", + "image", + "inspect", + alias, + "--format", + "{{.Id}}", + ]) + ).trim() !== configID + ) + throw new Error("Image alias content differs"); + images[name] = alias; + } + return images; +} +async function bootstrap() { + const inventory = ( + await command("cluster_inventory", [ + "docker", + "ps", + "-aq", + "--filter", + "label=k3d.cluster=" + cfg.cluster, + ]) + ).trim(); + let r: any; + if (await Bun.file(receiptFile).exists()) r = await receipt(); + else { + if (inventory) + throw new Error("Unclaimed existing cluster; refusing adoption"); + r = { + lab, + cluster: cfg.cluster, + nonce: crypto.randomUUID(), + state: "claimed", + }; + await writeFile(receiptFile, JSON.stringify(r) + "\n", { + mode: 0o600, + flag: "wx", + }); + } + if (r.lab !== lab || r.cluster !== cfg.cluster) + throw new Error("Receipt target differs"); + if (!inventory) { + r = { + lab, + cluster: cfg.cluster, + nonce: r.state === "claimed" ? r.nonce : crypto.randomUUID(), + state: "claimed", + }; + await save(r); + if ( + ( + await command("public_port_guard", [ + "ss", + "-H", + "-ltn", + `sport = :${cfg.port}`, + ]) + ).trim() + ) + throw new Error("Public port is occupied"); + await command("create_cluster", [ + "k3d", + "cluster", + "create", + cfg.cluster, + "--image", + "rancher/k3s:v1.37.1-k3s1@sha256:ca7f37d993d82ef0dcdcfecb2e0e2618ea541dbaffc620c8cedebe01a82acd0d", + "--servers", + "1", + "--agents", + "0", + "--servers-memory", + "8g", + "--api-port", + "127.0.0.1:0", + "--port", + `127.0.0.1:${cfg.port}:80@loadbalancer`, + "--k3s-arg", + "--disable=traefik@server:0", + "--runtime-label", + `vp.coursework.owner=${r.nonce}@server:0`, + "--kubeconfig-update-default=false", + "--kubeconfig-switch-context=false", + "--timeout", + "180s", + ]); + r.images = undefined; + } else { + const owner = ( + await command("cluster_owner", [ + "docker", + "inspect", + "--format", + '{{index .Config.Labels "vp.coursework.owner"}}', + "k3d-" + cfg.cluster + "-server-0", + ]) + ).trim(); + if (owner !== r.nonce) throw new Error("Existing server owner differs"); + await command("start_cluster", ["k3d", "cluster", "start", cfg.cluster]); + } + r.container = await serverID(); + const config = Bun.YAML.parse( + await command("private_kubeconfig", [ + "k3d", + "kubeconfig", + "get", + cfg.cluster, + ]), + ) as any; + const ports = JSON.parse( + await command("published_api_port", [ + "docker", + "inspect", + "--format", + "{{json .NetworkSettings.Ports}}", + "k3d-" + cfg.cluster + "-serverlb", + ]), + ); + const endpoint = ports["6443/tcp"]?.find( + (p: any) => p.HostIp === "127.0.0.1", + ); + if ( + !endpoint || + !/^\d+$/.test(endpoint.HostPort) || + Number(endpoint.HostPort) < 1024 || + Number(endpoint.HostPort) > 65535 + ) + throw new Error("Unverified Kubernetes API port"); + if (config.clusters?.length !== 1) + throw new Error("Unexpected kubeconfig cluster set"); + config.clusters[0].cluster.server = "https://127.0.0.1:" + endpoint.HostPort; + const http = ports["80/tcp"]?.find((p: any) => p.HostIp === "127.0.0.1"); + if (!http || Number(http.HostPort) !== cfg.port) + throw new Error("Public endpoint differs from claimed cluster"); + r.publicPort = cfg.port; + await writeFile(kubeconfig, Bun.YAML.stringify(config), { mode: 0o600 }); + await k(["wait", "--for=condition=Ready", "node", "--all", "--timeout=120s"]); + let ns = await namespace(); + if (ns && ns.metadata?.annotations?.["vp-mtuci/owner"] !== r.nonce) + throw new Error("Foreign namespace"); + if (!ns) { + await k( + ["create", "-f", "-"], + JSON.stringify({ + apiVersion: "v1", + kind: "Namespace", + metadata: { + name: cfg.namespace, + annotations: { "vp-mtuci/owner": r.nonce }, + labels: { "app.kubernetes.io/part-of": "vp-coursework" }, + }, + }), + ); + ns = await namespace(); + } + r.namespaceUID = ns.metadata.uid; + r.state = "ready"; + await save(r); + await command("credentials_bootstrap", [ + process.execPath, + "--no-env-file", + resolve(root, "scripts/bootstrap.ts"), + ]); + const secretFiles = { + pg_password: "pg_password", + database_url: "database_url", + cache_url: "cache_url", + valkey_conf: "valkey.conf", + ...(lab === 4 ? { s3_credentials: "s3_credentials" } : {}), + }; + const stringData: Record = {}; + for (const [key, file] of Object.entries(secretFiles)) + stringData[key] = ( + await Bun.file(resolve(root, ".local", file)).text() + ).trim(); + await k( + ["apply", "--server-side", "--field-manager=vp-coursework", "-f", "-"], + JSON.stringify({ + apiVersion: "v1", + kind: "Secret", + metadata: { name: "app-config", namespace: cfg.namespace }, + type: "Opaque", + stringData, + }), + ); + if (lab === 4) { + const data: Record = {}; + for (const name of ["s3_access", "s3_secret", "s3_root"]) + data[name] = ( + await Bun.file(resolve(root, ".local", name)).text() + ).trim(); + await k( + ["apply", "--server-side", "--field-manager=vp-coursework", "-f", "-"], + JSON.stringify({ + apiVersion: "v1", + kind: "Secret", + metadata: { name: "storage-root", namespace: cfg.namespace }, + type: "Opaque", + stringData: data, + }), + ); + } + const images = await imageSet(); + async function imported() { + return ( + await command("containerd_inventory", [ + "docker", + "exec", + "k3d-" + cfg.cluster + "-server-0", + "ctr", + "-n", + "k8s.io", + "images", + "list", + "-q", + ]) + ) + .trim() + .split("\n"); + } + let available = await imported(); + if ( + Object.values(images).some( + (image) => !available.includes("docker.io/" + image), + ) + ) { + const archive = resolve(local, "images-" + crypto.randomUUID() + ".tar"); + try { + await command( + "export_single_platform", + [ + "docker", + "image", + "save", + "--platform", + "linux/amd64", + "--output", + archive, + ...Object.values(images), + ], + undefined, + 240000, + ); + stage = "import_single_platform"; + const p = Bun.spawn( + [ + "docker", + "exec", + "-i", + "k3d-" + cfg.cluster + "-server-0", + "ctr", + "-n", + "k8s.io", + "images", + "import", + "--platform", + "linux/amd64", + "-", + ], + { + stdin: Bun.file(archive), + stdout: "pipe", + stderr: "pipe", + signal: AbortSignal.timeout(240000), + }, + ); + const [out, err] = await Promise.all([ + new Response(p.stdout).text(), + new Response(p.stderr).text(), + ]); + await writeFile(resolve(local, "image-import.txt"), out + err, { + mode: 0o600, + }); + if ((await p.exited) !== 0) + throw new Error("Native single-platform image import failed"); + } finally { + await rm(archive, { force: true }); + } + available = await imported(); + if ( + Object.values(images).some( + (image) => !available.includes("docker.io/" + image), + ) + ) + throw new Error("Imported images are missing from Kubernetes containerd"); + } + r.images = images; + await save(r); + await applyConfiguration(true); + for (const name of ["postgres", "valkey", ...(lab === 4 ? ["s3"] : [])]) + await readyDeployment(name); + const sqlReady = await k([ + "exec", + "deployment/postgres", + "--", + "psql", + "-h", + "127.0.0.1", + "-U", + "messenger", + "-d", + "messenger", + "-X", + "-qAt", + "-c", + "SELECT 1;", + ]); + if (sqlReady.trim() !== "1") + throw new Error("PostgreSQL did not execute the readiness query"); + await job("migrate", []); + if (lab === 4) await job("bootstrap-s3", []); + await applyConfiguration(false); + await ready(); + await writeFile( + resolve(evidence, "runtime.json"), + JSON.stringify( + { + cluster: cfg.cluster, + namespaceUID: r.namespaceUID, + k3s: "v1.37.1-k3s1", + pingap: "0.16.0", + images, + port: cfg.port, + }, + null, + 2, + ) + "\n", + ); + console.log("Ready: " + cfg.cluster + " via Pingap on localhost:" + cfg.port); +} +function integer( + value: string | undefined, + fallback: number, + min: number, + max: number, +) { + const n = Number(value ?? fallback); + if (!Number.isInteger(n) || n < min || n > max) + throw new Error("Invalid bounded runtime setting"); + return n; +} +async function applyConfiguration(initial: boolean) { + const r = await receipt(), + replicas = initial ? 0 : integer(process.env.API_REPLICAS, 2, 1, 4); + const cpu = process.env.API_CPUS ?? "1"; + if (!Number.isFinite(Number(cpu)) || Number(cpu) < 0.1 || Number(cpu) > 4) + throw new Error("Invalid CPU limit"); + const memory = process.env.API_MEMORY ?? (lab === 4 ? "2Gi" : "512Mi"); + const match = /^(\d+)(Mi|Gi|m|g)$/.exec(memory); + if (!match) throw new Error("Invalid memory limit"); + const mib = + Number(match[1]) * (match[2].toLowerCase().startsWith("g") ? 1024 : 1); + if (mib < 128 || mib > 2048) throw new Error("Unsafe memory limit"); + const soft = + process.env.GO_MEMORY_LIMIT ?? (lab === 4 ? "1536MiB" : "400MiB"); + const sm = /^(\d+)MiB$/.exec(soft); + if (!sm || Number(sm[1]) > mib * 0.8 || Number(sm[1]) < 64) + throw new Error("Unsafe soft memory limit"); + assertImageBudget(lab, mib, soft); + const apiPatch = { + apiVersion: "apps/v1", + kind: "Deployment", + metadata: { name: "api" }, + spec: { + replicas, + template: { + spec: { + containers: [ + { + name: "api", + resources: { + requests: { cpu: "100m", memory: "128Mi" }, + limits: { cpu, memory: mib + "Mi" }, + }, + env: [ + { + name: "PG_MAX_CONNS", + value: String(integer(process.env.PG_MAX_CONNS, 8, 1, 64)), + }, + { + name: "SESSION_TTL_SECONDS", + value: String( + integer(process.env.SESSION_TTL_SECONDS, 3600, 1, 86400), + ), + }, + { name: "GOMEMLIMIT", value: soft }, + ], + }, + ], + }, + }, + }, + }; + const render = resolve(local, "render"); + const overlay = { + apiVersion: "kustomize.config.k8s.io/v1beta1", + kind: "Kustomization", + resources: [relative(render, resolve(root, "deploy/k3s"))], + images: Object.entries(r.images).map(([name, alias]) => ({ + name: name === "api" ? "vp-messenger" : "vp-" + name, + newName: (alias as string).split(":")[0], + newTag: (alias as string).split(":")[1], + })), + patches: [ + { + target: { kind: "Deployment", name: "api" }, + patch: Bun.YAML.stringify(apiPatch), + }, + ], + }; + await mkdir(render, { recursive: true }); + await writeFile( + resolve(render, "kustomization.yaml"), + Bun.YAML.stringify(overlay), + ); + const manifest = await command("render_kustomize", [ + "kubectl", + "kustomize", + render, + "--load-restrictor=LoadRestrictionsNone", + ]); + // This runner owns the isolated namespace and reclaims replicas after explicit scale hooks. + await k( + [ + "apply", + "--dry-run=server", + "--server-side", + "--force-conflicts", + "--field-manager=vp-coursework", + "-f", + "-", + ], + manifest, + ); + await k( + [ + "apply", + "--server-side", + "--force-conflicts", + "--field-manager=vp-coursework", + "-f", + "-", + ], + manifest, + ); +} +async function readyDeployment(name: string) { + await k(["rollout", "status", "deployment/" + name, "--timeout=150s"]); +} +async function pods() { + return JSON.parse(await k(["get", "pods", "-o", "json"])).items; +} +async function ready() { + for (const name of [ + "postgres", + "valkey", + "api", + "pingap", + ...(lab === 4 ? ["s3"] : []), + ]) + await readyDeployment(name); + const drainDeadline = performance.now() + 40000; + for (;;) { + const draining = (await pods()).some( + (p: any) => + p.metadata.deletionTimestamp && + ["api", "postgres", "valkey", "pingap", "s3"].includes( + p.metadata.labels?.app, + ), + ); + if (!draining) break; + if (performance.now() >= drainDeadline) + throw new Error("Old workload Pods did not finish terminating"); + await Bun.sleep(250); + } + await command( + "http_discovery_ready", + [process.execPath, "--no-env-file", resolve(root, "student-tests/wait.ts")], + undefined, + 120000, + ); +} +async function job(mode: string, extra: string[]) { + const allowed = [ + "migrate", + "bootstrap-s3", + "fixture-cleanup", + "reconcile", + "integration", + "image-memory", + ]; + if (!allowed.includes(mode) || (lab === 3 && mode !== "migrate")) + throw new Error("Unsupported Job"); + if (mode === "integration" && !cfg.cluster.includes("-r-")) + throw new Error( + "Destructive integration requires a fresh research cluster", + ); + if (mode === "fixture-cleanup" && !/^st_[a-f0-9]{16}$/.test(extra[0] ?? "")) + throw new Error("Invalid fixture prefix"); + async function gameGuard() { + const p = Bun.spawn(["game-running"], { stdout: "ignore", stderr: "pipe" }); + await new Response(p.stderr).text(); + assertNoGame(await p.exited); + } + if (mode === "image-memory") await gameGuard(); + const template = JSON.parse( + await k(["get", "deployment", "api", "-o", "json"]), + ).spec.template; + const name = "task-" + mode + "-" + crypto.randomUUID().slice(0, 8); + const c = template.spec.containers[0]; + delete c.readinessProbe; + delete c.livenessProbe; + delete c.startupProbe; + delete c.lifecycle; + delete c.ports; + c.name = "task"; + c.command = [ + mode === "integration" + ? "/integration.test" + : mode === "image-memory" + ? "/image-memory.test" + : mode === "fixture-cleanup" + ? "/fixture-cleanup" + : "/messenger", + ]; + c.args = + mode === "integration" + ? [ + "-test.v", + "-test.run", + "Test(ReconciliationAgainstPostgresAndPrivateS3|S3InventoryAndStatReturnComparableVersionMetadata|FixtureCleanupRejectsForeignMembership)", + "-test.timeout=150s", + ] + : mode === "image-memory" + ? [ + "-test.v", + "-test.run", + "TestWorstCaseImagesWithinBudget", + "-test.timeout=120s", + ] + : mode === "fixture-cleanup" + ? extra + : ["-" + mode, ...extra]; + if (mode === "integration") + c.env.push({ name: "RUN_ISOLATED_RECONCILIATION", value: "1" }); + if (mode === "image-memory") { + c.env.push({ name: "RUN_IMAGE_STRESS", value: "1" }); + c.resources = { + requests: { cpu: "100m", memory: "128Mi" }, + limits: { cpu: "2", memory: "2Gi" }, + }; + } + if (mode === "bootstrap-s3") { + const volume = template.spec.volumes.find( + (v: any) => v.name === "credentials", + ); + const items = volume.secret.items; + delete volume.secret; + volume.projected = { + defaultMode: 288, + sources: [ + { secret: { name: "app-config", items } }, + { + secret: { + name: "storage-root", + items: [{ key: "s3_root", path: "s3_root" }], + }, + }, + ], + }; + } + template.metadata = { labels: { app: name } }; + template.spec.restartPolicy = "Never"; + template.spec.terminationGracePeriodSeconds = 10; + await k( + ["create", "-f", "-"], + JSON.stringify({ + apiVersion: "batch/v1", + kind: "Job", + metadata: { name }, + spec: { + backoffLimit: 0, + activeDeadlineSeconds: 200, + ttlSecondsAfterFinished: 300, + template, + }, + }), + ); + let success = false; + return withCleanup({ + perform: async () => { + for (let attempt = 0; attempt < 210; attempt++) { + const j = JSON.parse(await k(["get", "job", name, "-o", "json"])); + if (j.status?.succeeded) { + success = true; + break; + } + if (j.status?.failed) break; + await Bun.sleep(1000); + } + const output = await k(["logs", "job/" + name]); + if (!success) { + await writeFile(resolve(local, "failed-job.txt"), output, { + mode: 0o600, + }); + const snapshot = await k([ + "get", + "pods", + "-l", + "job-name=" + name, + "-o", + "json", + ]); + await writeFile(resolve(local, "failed-job-pods.json"), snapshot, { + mode: 0o600, + }); + throw new Error("Job " + mode + " failed; private diagnostics saved"); + } + if (mode === "image-memory") await gameGuard(); + return output; + }, + cleanup: async () => { + await k(["delete", "job", name, "--wait=true", "--timeout=30s"]); + }, + }); +} +async function execute() { + if (action === "info") { + const r = await receipt(); + console.log( + JSON.stringify({ + cluster: cfg.cluster, + port: r.publicPort, + namespace: cfg.namespace, + images: r.images, + }), + ); + } else if (action === "stats") { + const out = []; + for (const p of (await pods()).filter( + (p: any) => + p.metadata.labels?.app === "api" && !p.metadata.deletionTimestamp, + )) { + const id = p.status.containerStatuses?.[0]?.containerID?.replace( + /^containerd:\/\//, + "", + ); + if (!/^[a-f0-9]{64}$/.test(id ?? "")) + throw new Error("API container identity unavailable"); + const inspected = JSON.parse( + await command("container_pid", [ + "docker", + "exec", + "k3d-" + cfg.cluster + "-server-0", + "crictl", + "inspect", + "-o", + "json", + id, + ]), + ); + const pid = Number(inspected.info?.pid); + if (!Number.isInteger(pid) || pid < 1) + throw new Error("Invalid API process ID"); + const raw = await command("container_cgroup", [ + "docker", + "exec", + "k3d-" + cfg.cluster + "-server-0", + "cat", + "/proc/" + pid + "/cgroup", + ]); + const group = raw + .split("\n") + .find((x) => x.startsWith("0::")) + ?.slice(3); + if ( + !group || + !group.startsWith("/") || + group.includes("..") || + !group.includes(id) + ) + throw new Error("Unverified API cgroup path"); + async function metric(file: string) { + return command("cgroup_" + file.replace(".", "_"), [ + "docker", + "exec", + "k3d-" + cfg.cluster + "-server-0", + "cat", + "/sys/fs/cgroup" + group + "/" + file, + ]); + } + const [current, peak, cpu] = await Promise.all([ + metric("memory.current"), + metric("memory.peak"), + metric("cpu.stat"), + ]); + const values = Object.fromEntries( + cpu + .trim() + .split("\n") + .map((x) => x.split(/\s+/)), + ); + out.push({ + pod: p.metadata.name, + uid: p.metadata.uid, + image: p.status.containerStatuses[0].imageID, + memory_current_bytes: Number(current.trim()), + memory_peak_bytes: Number(peak.trim()), + cpu_usage_usec: Number(values.usage_usec), + limits: p.spec.containers[0].resources.limits, + }); + } + console.log(JSON.stringify({ at: new Date().toISOString(), pods: out })); + } else if (action === "configure") { + await applyConfiguration(false); + await ready(); + } else if (action === "ready") await ready(); + else if (action === "kubectl") { + assertScopedArgs(args); + const input = + args.includes("-i") || args.includes("--stdin") + ? await Bun.stdin.text() + : undefined; + if (input !== undefined && input.length > 1024 * 1024) + throw new Error("Operational stdin exceeds limit"); + process.stdout.write(await k(args, input)); + } else if (action === "task") + process.stdout.write(await job(args[0], args.slice(1))); + else if (action === "restart") { + const runID = crypto.randomUUID(); + const selected = (items: any[]) => + items + .filter( + (p) => + !p.metadata.deletionTimestamp && + ["api", "postgres", "valkey", "pingap", "s3"].includes( + p.metadata.labels?.app, + ), + ) + .map((p) => ({ + name: p.metadata.name, + uid: p.metadata.uid, + role: p.metadata.labels.app, + started: p.status.startTime, + })); + const before = selected(await pods()); + if (!before.length) throw new Error("No workload Pods to restart"); + await writeFile( + resolve(evidence, "restart-before.json"), + JSON.stringify({ run_id: runID, pods: before }, null, 2) + "\n", + ); + await k(["rollout", "restart", "deployment"]); + await ready(); + const after = selected(await pods()); + if (!after.length || after.some((p) => before.some((b) => b.uid === p.uid))) + throw new Error("An original workload Pod was not replaced"); + await writeFile( + resolve(evidence, "restart-after.json"), + JSON.stringify({ run_id: runID, pods: after }, null, 2) + "\n", + ); + } else if (action === "stop-one") { + const target = process.env.TARGET_INSTANCE_ID; + if (!target || !/^[a-z0-9-]+$/.test(target)) + throw new Error("Actual target pod name required"); + const items = (await pods()).filter( + (p: any) => + p.metadata.labels?.app === "api" && + !p.metadata.deletionTimestamp && + p.status.conditions?.some( + (c: any) => c.type === "Ready" && c.status === "True", + ), + ); + const victim = items.find((p: any) => p.metadata.name === target); + if (items.length !== 2 || !victim) + throw new Error("Target must belong to two ready API pods"); + await writeFile( + resolve(evidence, "stop-one-before.json"), + JSON.stringify( + { + target, + uid: victim.metadata.uid, + pods: items.map((p: any) => p.metadata.name), + }, + null, + 2, + ), + ); + const containerID = + victim.status.containerStatuses?.[0]?.containerID?.replace( + /^containerd:\/\//, + "", + ); + if (!/^[a-f0-9]{64}$/.test(containerID ?? "")) + throw new Error("Unverified target container"); + for (const p of items) + await k([ + "patch", + "pod", + p.metadata.name, + "--type=merge", + "-p", + JSON.stringify({ + metadata: { + uid: p.metadata.uid, + annotations: { + "controller.kubernetes.io/pod-deletion-cost": + p === victim ? "-1000000" : "1000000", + }, + }, + }), + ]); + await k([ + "scale", + "deployment/api", + "--current-replicas=2", + "--replicas=1", + ]); + let terminating: any; + for (let i = 0; i < 15; i++) { + const current = (await pods()).find( + (p: any) => p.metadata.uid === victim.metadata.uid, + ); + if (current?.metadata.deletionTimestamp) { + terminating = current; + break; + } + await Bun.sleep(100); + } + if (!terminating) + throw new Error("Controller did not select the intended target"); + const currentCID = + terminating.status.containerStatuses?.[0]?.containerID?.replace( + /^containerd:\/\//, + "", + ); + if (!/^[a-f0-9]{64}$/.test(currentCID ?? "")) + throw new Error("Terminating process identity unavailable"); + await command( + "stop_target_process", + [ + "docker", + "exec", + "k3d-" + cfg.cluster + "-server-0", + "ctr", + "-n", + "k8s.io", + "tasks", + "kill", + "--signal", + "SIGKILL", + currentCID, + ], + undefined, + 4000, + ); + let stopped: any; + for (let i = 0; i < 15; i++) { + stopped = JSON.parse( + await command("verify_stopped_process", [ + "docker", + "exec", + "k3d-" + cfg.cluster + "-server-0", + "crictl", + "inspect", + "-o", + "json", + currentCID, + ]), + ); + if (stopped.status?.state === "CONTAINER_EXITED") break; + await Bun.sleep(100); + } + if (stopped.status?.state !== "CONTAINER_EXITED") + throw new Error("Target process did not stop"); + if ( + stopped.status?.labels?.["io.kubernetes.pod.uid"] !== victim.metadata.uid + ) + throw new Error("Stopped process Pod UID differs"); + const running = JSON.parse( + await command("verify_no_running_victim", [ + "docker", + "exec", + "k3d-" + cfg.cluster + "-server-0", + "crictl", + "ps", + "--state", + "Running", + "-o", + "json", + ]), + ); + assertNoRunningContainers(running.containers ?? [], victim.metadata.uid); + const finalVictim = (await pods()).find( + (p: any) => p.metadata.uid === victim.metadata.uid, + ); + if ( + finalVictim?.status.containerStatuses?.some( + (c: any) => c.containerID !== "containerd://" + currentCID, + ) + ) + throw new Error("Target process changed during failure injection"); + const remaining = (await pods()).filter( + (p: any) => + p.metadata.labels?.app === "api" && !p.metadata.deletionTimestamp, + ); + if ( + remaining.length !== 1 || + remaining[0].metadata.uid === victim.metadata.uid + ) + throw new Error("Unexpected API survivor"); + await writeFile( + resolve(evidence, "stop-one-after.json"), + JSON.stringify( + { + stopped: target, + stoppedUID: victim.metadata.uid, + containerID: currentCID, + state: "CONTAINER_EXITED", + survivor: remaining[0].metadata.name, + }, + null, + 2, + ), + ); + } else if (action === "destroy") { + await command("destroy_claimed_cluster", [ + "k3d", + "cluster", + "delete", + cfg.cluster, + ]); + const r = await receipt(); + r.state = "destroyed"; + await save(r); + } else if (action === "stop") + await command("stop_claimed_cluster", [ + "k3d", + "cluster", + "stop", + cfg.cluster, + ]); + else throw new Error("Unknown runtime action"); +} +async function destroyPartial() { + const r = await receipt(); + const inventory = ( + await command("partial_inventory", [ + "docker", + "ps", + "-aq", + "--filter", + "label=k3d.cluster=" + cfg.cluster, + ]) + ).trim(); + if (!inventory) { + r.state = "destroyed"; + await save(r); + return; + } + const inspected = JSON.parse( + await command("partial_server_identity", [ + "docker", + "inspect", + "k3d-" + cfg.cluster + "-server-0", + ]), + ); + const server = { + container: inspected[0].Id, + owner: inspected[0].Config.Labels["vp.coursework.owner"], + }; + assertPartialClaim(r, server, cfg); + r.container = server.container; + await save(r); + await command("destroy_partial_claimed_cluster", [ + "k3d", + "cluster", + "delete", + cfg.cluster, + ]); + r.state = "destroyed"; + await save(r); +} +try { + if (action === "check") console.log("Parsed k3s runtime for lab" + lab); + else if (action === "up") await bootstrap(); + else if (action === "destroy" && (await receipt()).state === "claimed") + await destroyPartial(); + else await operator.run(action); +} catch (error) { + await writeFile( + resolve(evidence, "last-failure.json"), + JSON.stringify({ + stage, + action, + error: error instanceof Error ? error.message : "unknown", + }) + "\n", + ); + throw error; +} diff --git a/scripts/kube.sh b/scripts/kube.sh new file mode 100755 index 00000000..ea6746c8 --- /dev/null +++ b/scripts/kube.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "$0")/.." +exec bun --no-env-file scripts/k3s.ts kubectl "$@" diff --git a/scripts/restart.sh b/scripts/restart.sh new file mode 100755 index 00000000..735d76d1 --- /dev/null +++ b/scripts/restart.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "$0")/.." +if [ "${VP_RUNTIME:-k3s}" = k3s ]; then exec bun --no-env-file scripts/k3s.ts restart; fi +mkdir -p evidence +ids=(); while IFS= read -r id; do ids+=("$id"); done < <(./scripts/compose.sh ps -q postgres valkey api) +test "${#ids[@]}" -ge 4 +docker inspect --format '{{.Name}} {{.Id}} {{.State.StartedAt}}' "${ids[@]}" >evidence/restart-before.txt +./scripts/compose.sh restart postgres valkey api lb +docker inspect --format '{{.Name}} {{.Id}} {{.State.StartedAt}}' "${ids[@]}" >evidence/restart-after.txt diff --git a/scripts/stop-one.sh b/scripts/stop-one.sh new file mode 100755 index 00000000..e139cd22 --- /dev/null +++ b/scripts/stop-one.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "$0")/.." +if [ "${VP_RUNTIME:-k3s}" = k3s ]; then exec bun --no-env-file scripts/k3s.ts stop-one; fi +: "${TARGET_INSTANCE_ID:?public resilience test must provide target instance}" +[[ "$TARGET_INSTANCE_ID" =~ ^[a-zA-Z0-9._-]+$ ]] +ids=(); while IFS= read -r id; do ids+=("$id"); done < <(./scripts/compose.sh ps -q api) +test "${#ids[@]}" -ge 2 +for id in "${ids[@]}"; do + hostname=$(docker inspect --format '{{.Config.Hostname}}' "$id") + if [ "$hostname" = "$TARGET_INSTANCE_ID" ]; then + mkdir -p evidence + docker inspect --format '{{.Name}} {{.Id}} {{.State.Running}}' "$id" >evidence/stop-one-before.txt + docker stop --time 8 "$id" >/dev/null + docker inspect --format '{{.Name}} {{.Id}} {{.State.Running}}' "$id" >evidence/stop-one-after.txt + exit 0 + fi +done +echo 'Target is not a running replica in this Compose project' >&2 +exit 1 diff --git a/scripts/up.sh b/scripts/up.sh new file mode 100755 index 00000000..7a59e953 --- /dev/null +++ b/scripts/up.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "$0")/.." +exec bun --no-env-file scripts/k3s.ts up diff --git a/student-tests/acceptance.ts b/student-tests/acceptance.ts new file mode 100644 index 00000000..d344f1d2 --- /dev/null +++ b/student-tests/acceptance.ts @@ -0,0 +1,428 @@ +import { resolve } from "node:path"; +const root = resolve(import.meta.dir, ".."); +const lab = (await Bun.file(resolve(root, "lab.json")).json()).number; +const base = process.env.BASE_URL ?? "http://127.0.0.1:28203"; +const kubernetes = process.env.VP_RUNTIME !== "compose"; +if (kubernetes) { + const p = Bun.spawn( + [ + process.execPath, + "--no-env-file", + resolve(root, "scripts/k3s.ts"), + "info", + ], + { cwd: root, stdout: "pipe", stderr: "pipe" }, + ); + const [out, err] = await Promise.all([ + new Response(p.stdout).text(), + new Response(p.stderr).text(), + ]); + if ((await p.exited) !== 0) + throw new Error("Claimed Kubernetes endpoint unavailable"); + const info = JSON.parse(out); + if (new URL(base).origin !== "http://127.0.0.1:" + info.port) + throw new Error("HTTP target differs from the claimed cluster"); +} +const prefix = `st_${crypto.randomUUID().replaceAll("-", "").slice(0, 16)}`; +let assertions = 0; +let operation = "initialization"; +function check(value: unknown, message: string): asserts value { + if (!value) throw new Error(message); + assertions++; +} +async function call( + method: string, + path: string, + status: number, + token?: string, + body?: unknown, + headers: Record = {}, +) { + operation = method + " " + path; + const response = await fetch(base + path, { + method, + headers: { + ...(token ? { Authorization: `Bearer ${token}` } : {}), + ...(body !== undefined ? { "Content-Type": "application/json" } : {}), + ...headers, + }, + body: body === undefined ? undefined : JSON.stringify(body), + signal: AbortSignal.timeout(8000), + }); + const bytes = await response.arrayBuffer(); + let json: any; + try { + json = JSON.parse(new TextDecoder().decode(bytes)); + } catch {} + check( + response.status === status, + `${method} ${path}: expected ${status}, got ${response.status}`, + ); + check(Boolean(response.headers.get("X-Request-Id")), "Missing request ID"); + if (status >= 400) + check( + json?.error?.request_id === response.headers.get("X-Request-Id"), + "Error request ID mismatch", + ); + return { json, response, bytes }; +} +const password = "synthetic:пароль🙂123"; +async function user(suffix: string) { + const registration = { + username: prefix + suffix, + display_name: "Синтетический тест", + password, + }; + const { json } = await call( + "POST", + "/api/v1/users", + 201, + undefined, + registration, + ); + const login = await call( + "POST", + "/api/v1/auth/sessions", + 201, + undefined, + undefined, + { + Authorization: + "Basic " + + Buffer.from(registration.username + ":" + password).toString("base64"), + }, + ); + check(!JSON.stringify(json).includes("password"), "Password leaked in User"); + check( + typeof login.json.token === "string" && login.json.token.length >= 43, + "Token entropy/shape", + ); + return { id: json.id, token: login.json.token, registration }; +} +async function cleanup() { + // No API delete exists. Scope every statement to this run's random username prefix. + const sql = `BEGIN; + CREATE TEMP TABLE own_users AS SELECT id FROM users WHERE left(username,${prefix.length})='${prefix}'; + DO $fixture$ BEGIN IF EXISTS(SELECT 1 FROM chat_members mine JOIN chat_members other ON other.chat_id=mine.chat_id WHERE mine.user_id IN(SELECT id FROM own_users) AND other.user_id NOT IN(SELECT id FROM own_users)) THEN RAISE EXCEPTION 'fixture has foreign memberships';END IF;END $fixture$; + CREATE TEMP TABLE own_chats AS SELECT DISTINCT mine.chat_id AS id FROM chat_members mine WHERE mine.user_id IN (SELECT id FROM own_users) AND NOT EXISTS(SELECT 1 FROM chat_members other WHERE other.chat_id=mine.chat_id AND other.user_id NOT IN(SELECT id FROM own_users)); + ${lab >= 3 ? "DELETE FROM idempotency WHERE user_id IN (SELECT id FROM own_users);" : ""} + DELETE FROM messages WHERE sender_id IN (SELECT id FROM own_users); + DELETE FROM sessions WHERE user_id IN (SELECT id FROM own_users); + DELETE FROM chat_members WHERE chat_id IN (SELECT id FROM own_chats); + DELETE FROM chats WHERE id IN (SELECT id FROM own_chats); + DELETE FROM users WHERE id IN (SELECT id FROM own_users); + COMMIT; + SELECT count(*) FROM users WHERE left(username,${prefix.length})='${prefix}';`; + const p = Bun.spawn( + kubernetes + ? [ + resolve(root, "scripts/kube.sh"), + "exec", + "-i", + "deployment/postgres", + "--", + "psql", + "-X", + "-qAt", + "-U", + "messenger", + "-d", + "messenger", + "-v", + "ON_ERROR_STOP=1", + ] + : [ + resolve(root, "scripts/compose.sh"), + "exec", + "-T", + "postgres", + "psql", + "-X", + "-qAt", + "-U", + "messenger", + "-d", + "messenger", + "-v", + "ON_ERROR_STOP=1", + ], + { cwd: root, stdin: "pipe", stdout: "pipe", stderr: "pipe" }, + ); + p.stdin.write(sql); + p.stdin.end(); + const out = await new Response(p.stdout).text(); + const err = await new Response(p.stderr).text(); + if ((await p.exited) !== 0) + throw new Error( + "Fixture cleanup failed: " + + err.replace(/password|token/gi, "[redacted]"), + ); + check( + out.trim() === "0", + "Fixture users remain after cleanup or SQL stdin was not executed", + ); +} +let primary: unknown; +try { + const alice = await user("a"), + bob = await user("b"), + eve = await user("e"); + await call("POST", "/api/v1/users", 400, undefined, { + username: prefix + "x", + display_name: "x", + }); + await call("POST", "/api/v1/users", 400, undefined, { + ...alice.registration, + password: "short", + }); + await call("POST", "/api/v1/users", 400, undefined, { + ...alice.registration, + extra: 1, + }); + const race = await Promise.all( + [0, 1].map(async () => { + const r = await fetch(base + "/api/v1/users", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ + ...alice.registration, + username: prefix + "race", + }), + }); + await r.arrayBuffer(); + return r.status; + }), + ); + check( + race.sort().join(",") === "201,409", + "Registration race must create exactly one user", + ); + const denied = await call( + "GET", + "/api/v1/users/me", + 401, + undefined, + undefined, + { "X-User-Id": alice.id }, + ); + check( + denied.response.headers.get("WWW-Authenticate") === + 'Bearer realm="messenger"', + "Bearer challenge", + ); + const wrong = await call( + "POST", + "/api/v1/auth/sessions", + 401, + undefined, + undefined, + { + Authorization: + "Basic " + + Buffer.from(alice.registration.username + ":wrong-password").toString( + "base64", + ), + }, + ); + check( + wrong.response.headers.get("WWW-Authenticate") === + 'Basic realm="messenger", charset="UTF-8"', + "Basic challenge", + ); + const invalidChat = { + title: "rollback", + member_ids: [alice.id, crypto.randomUUID()], + }; + await call("POST", "/api/v1/chats", 400, alice.token, invalidChat); + let page = (await call("GET", "/api/v1/chats", 200, alice.token)).json; + check( + page.items.length === 0 && page.next_cursor === null, + "Failed composite create left a chat", + ); + const chat = ( + await call("POST", "/api/v1/chats", 201, alice.token, { + title: "Пагинация", + member_ids: [bob.id, alice.id], + }) + ).json; + const path = "/api/v1/chats/" + chat.id + "/messages"; + check( + (await call("GET", path, 200, alice.token)).json.items.length === 0, + "Empty page", + ); + for (const limit of ["0", "-1", "101", "1.2", "abc"]) + await call("GET", path + "?limit=" + limit, 400, alice.token); + await call("GET", path + "?cursor=%%%", 400, alice.token); + await call("GET", path, 404, eve.token); + const sent = []; + for (let i = 0; i < 102; i++) { + const h = lab >= 3 ? { "Idempotency-Key": crypto.randomUUID() } : {}; + sent.push( + ( + await call( + "POST", + path, + 201, + alice.token, + { text: `Сообщение ${i}` }, + h, + ) + ).json, + ); + } + check( + (await call("GET", path, 200, bob.token)).json.items.length === 50, + "Default bound", + ); + check( + (await call("GET", path + "?limit=100", 200, bob.token)).json.items + .length === 100, + "Maximum bound", + ); + const seen = []; + let cursor: string | null = null; + do { + page = ( + await call( + "GET", + path + + "?limit=7" + + (cursor ? "&cursor=" + encodeURIComponent(cursor) : ""), + 200, + bob.token, + ) + ).json; + check(page.items.length <= 7, "Page bound"); + seen.push(...page.items); + cursor = page.next_cursor; + } while (cursor); + check( + JSON.stringify(seen) === JSON.stringify(sent), + "Traversal must preserve every item exactly once", + ); + const other = ( + await call("POST", "/api/v1/chats", 201, alice.token, { + title: "Другой", + member_ids: [alice.id], + }) + ).json; + const first = (await call("GET", path + "?limit=1", 200, alice.token)).json; + await call( + "GET", + "/api/v1/chats/" + + other.id + + "/messages?cursor=" + + encodeURIComponent(first.next_cursor), + 400, + alice.token, + ); + if (lab >= 3) { + const key = crypto.randomUUID(), + headers = { "Idempotency-Key": key }, + body = { text: "один конкурентный результат" }; + const results = await Promise.all( + Array.from({ length: 12 }, () => + call("POST", path, 201, alice.token, body, headers), + ), + ); + check( + new Set(results.map((r) => r.json.id)).size === 1, + "Concurrent retries duplicated a message", + ); + await call("POST", path, 409, alice.token, { text: "другой" }, headers); + await call("POST", path, 400, alice.token, { text: "без ключа" }); + const ids = new Set(); + for (let i = 0; i < 20; i++) + ids.add( + ( + await call("GET", "/api/v1/users/me", 200, alice.token) + ).response.headers.get("X-Instance-Id")!, + ); + check( + ids.size >= 2 && !ids.has(null as any), + "One session must reach multiple actual replicas", + ); + } + await call("DELETE", "/api/v1/auth/sessions/current", 204, alice.token); + await call("GET", "/api/v1/users/me", 401, alice.token); + if (process.env.FAILURES === "1") { + async function compose(args: string[], ttl?: string) { + const p = Bun.spawn([resolve(root, "scripts/compose.sh"), ...args], { + cwd: root, + env: { ...process.env, ...(ttl ? { SESSION_TTL_SECONDS: ttl } : {}) }, + stdout: "pipe", + stderr: "pipe", + }); + await Promise.all([ + new Response(p.stdout).text(), + new Response(p.stderr).text(), + ]); + check((await p.exited) === 0, "Compose failure action failed"); + } + async function ready() { + for (let i = 0; i < 150; i++) { + try { + const r = await fetch(base + "/health/ready", { + signal: AbortSignal.timeout(1500), + }); + await r.arrayBuffer(); + if (r.status === 200) return; + } catch {} + await Bun.sleep(100); + } + throw new Error("Readiness did not recover"); + } + try { + await compose(["stop", "valkey"]); + await call("GET", "/api/v1/users/me", 200, bob.token); + await call("GET", "/api/v1/users/me", 401, undefined, undefined, { + "X-User-Id": bob.id, + }); + } finally { + await compose(["start", "valkey"]); + } + try { + await compose(["stop", "postgres"]); + await call("GET", "/api/v1/users/me", 503, bob.token); + await call("GET", "/health/ready", 503); + await call("GET", "/health/live", 200); + } finally { + await compose(["start", "postgres"]); + await ready(); + } + await call("GET", "/api/v1/users/me", 200, bob.token); + if (lab === 2) { + try { + await compose( + ["up", "-d", "--no-deps", "--force-recreate", "api"], + "2", + ); + await ready(); + const short = await user("ttl"); + await call("GET", "/api/v1/users/me", 200, short.token); + await Bun.sleep(2200); + await call("GET", "/api/v1/users/me", 401, short.token); + } finally { + await compose( + ["up", "-d", "--no-deps", "--force-recreate", "api"], + "3600", + ); + await ready(); + } + } + } +} catch (error) { + primary = new Error("Acceptance failed during " + operation, { + cause: error, + }); +} +try { + await cleanup(); +} catch (error) { + console.error(String(error)); + if (!primary) primary = error; +} +if (primary) throw primary; +console.log( + `PASS lab${lab}: ${assertions} HTTP assertions, registration race, rollback, pagination, authentication${lab >= 3 ? ", concurrent idempotency and replica sharing" : ""}; fixture cleanup completed`, +); diff --git a/student-tests/k3s-model.test.ts b/student-tests/k3s-model.test.ts new file mode 100644 index 00000000..51ab9932 --- /dev/null +++ b/student-tests/k3s-model.test.ts @@ -0,0 +1,288 @@ +import { test, expect } from "bun:test"; +import { + settings, + assertOwned, + guardedOperator, + pinnedConfigID, + assertScopedArgs, + assertNoGame, + assertPartialClaim, + assertNoRunningContainers, + withCleanup, + assertImageBudget, +} from "../scripts/k3s-model"; + +test("rejects an image API budget below the verified decoder limit", () => { + expect(() => assertImageBudget(4, 512, "384MiB")).toThrow(); +}); +test("accepts the verified image API budget", () => { + expect(() => assertImageBudget(4, 2048, "1536MiB")).not.toThrow(); +}); +test("allows smaller text-only API research budgets", () => { + expect(() => assertImageBudget(3, 512, "384MiB")).not.toThrow(); +}); + +test("cleanup failure preserves the original operation error", async () => { + const primary = new Error("primary operation"); + try { + await withCleanup({ + perform: async () => { + throw primary; + }, + cleanup: async () => { + throw new Error("cleanup"); + }, + }); + throw new Error("unexpected success"); + } catch (error) { + expect((error as Error).cause).toBe(primary); + } +}); +test("cleanup failure cannot publish a successful operation", async () => { + await expect( + withCleanup({ + perform: async () => 42, + cleanup: async () => { + throw new Error("cleanup"); + }, + }), + ).rejects.toThrow("cleanup"); +}); + +test("accepts the canonical Docker Hub form of a pinned repository", () => { + expect( + pinnedConfigID( + { + Id: "sha256:config", + RepoDigests: ["docker.io/library/postgres@sha256:manifest"], + }, + "postgres:tag@sha256:manifest", + ), + ).toBe("sha256:config"); +}); +test.each([ + { name: "platform" }, + { name: "vp-lab4-medvedev" }, + { name: "../vp-lab3" }, + { name: "vp-lab3;echo" }, +])("rejects foreign or malformed cluster $name", ({ name }) => { + expect(() => settings(3, { VP_CLUSTER: name })).toThrow(); +}); +test.each([ + { port: "0" }, + { port: "65536" }, + { port: "NaN" }, + { port: "28203;echo" }, +])("rejects invalid public port $port", ({ port }) => { + expect(() => settings(3, { PUBLIC_PORT: port })).toThrow(); +}); +test("accepts default and isolated experiment names", () => { + expect(settings(3).cluster).toBe("vp-lab3-medvedev"); + expect(settings(3, { VP_CLUSTER: "vp-lab3-r-1234abcd" }).cluster).toBe( + "vp-lab3-r-1234abcd", + ); +}); +const expected = { lab: 3, cluster: "vp-lab3-medvedev" }; +const receipt = { + lab: 3, + cluster: expected.cluster, + container: "owned-container", + namespaceUID: "owned-namespace", +}; +test("rejects an unclaimed cluster", () => { + expect(() => + assertOwned(undefined, { container: "owned-container" }, expected), + ).toThrow(); +}); +test("rejects a recreated foreign container", () => { + expect(() => + assertOwned( + receipt, + { container: "foreign-container", namespaceUID: "owned-namespace" }, + expected, + ), + ).toThrow(); +}); +test("rejects a replaced namespace", () => { + expect(() => + assertOwned( + receipt, + { container: "owned-container", namespaceUID: "foreign-namespace" }, + expected, + ), + ).toThrow(); +}); +test("accepts the exact claimed cluster and namespace", () => { + expect(() => + assertOwned( + receipt, + { container: "owned-container", namespaceUID: "owned-namespace" }, + expected, + ), + ).not.toThrow(); +}); +test("foreign cluster never reaches the mutation port", async () => { + let dispatched = 0; + const operator = guardedOperator(expected, { + receipt: async () => receipt, + actual: async () => ({ + container: "foreign-container", + namespaceUID: "owned-namespace", + }), + dispatch: async () => { + dispatched++; + }, + }); + await expect(operator.run("delete")).rejects.toThrow(); + expect(dispatched).toBe(0); +}); +test("inventory failure never reaches the mutation port", async () => { + let dispatched = 0; + const operator = guardedOperator(expected, { + receipt: async () => receipt, + actual: async () => { + throw new Error("inventory unavailable"); + }, + dispatch: async () => { + dispatched++; + }, + }); + await expect(operator.run("delete")).rejects.toThrow("inventory unavailable"); + expect(dispatched).toBe(0); +}); +test("claimed cluster dispatches the requested action once", async () => { + const actions: string[] = []; + const operator = guardedOperator(expected, { + receipt: async () => receipt, + actual: async () => ({ + container: receipt.container, + namespaceUID: receipt.namespaceUID, + }), + dispatch: async (action) => { + actions.push(action); + }, + }); + await operator.run("restart"); + expect(actions).toEqual(["restart"]); +}); +test("accepts pinned manifest identity when image config ID differs", () => { + expect( + pinnedConfigID( + { Id: "sha256:config", RepoDigests: ["example/image@sha256:manifest"] }, + "example/image:tag@sha256:manifest", + ), + ).toBe("sha256:config"); +}); +test("rejects an unpinned image", () => { + expect(() => + pinnedConfigID( + { Id: "sha256:config", RepoDigests: ["example/image@sha256:other"] }, + "example/image:tag@sha256:manifest", + ), + ).toThrow(); +}); +test.each([ + { args: ["get", "pods", "-nforeign"] }, + { args: ["get", "pods", "--cluster=foreign"] }, + { args: ["get", "nodes"] }, + { args: ["get", "secrets"] }, +])("rejects target or resource override $args", ({ args }) => { + expect(() => assertScopedArgs(args)).toThrow(); +}); +test("allows flags belonging to the executed application", () => { + expect(() => + assertScopedArgs([ + "exec", + "deployment/postgres", + "--", + "psql", + "--user", + "messenger", + ]), + ).not.toThrow(); +}); +test("allows stdin for scoped PostgreSQL execution", () => { + expect(() => + assertScopedArgs(["exec", "-i", "deployment/postgres", "--", "psql"]), + ).not.toThrow(); +}); +test("rejects a second resource that discloses a Secret", () => { + expect(() => + assertScopedArgs([ + "get", + "pods/existing-api", + "secrets/app-config", + "-o", + "json", + ]), + ).toThrow(); +}); +test("rejects the short server override", () => { + expect(() => + assertScopedArgs(["get", "pods", "-shttps://foreign"]), + ).toThrow(); +}); +test.each([{ code: 0 }, { code: 2 }, { code: -1 }])( + "refuses measurement for active or unknown game status $code", + ({ code }) => { + expect(() => assertNoGame(code)).toThrow(); + }, +); +test("accepts measurement only for confirmed inactive game", () => { + expect(() => assertNoGame(1)).not.toThrow(); +}); +test("rejects extra resources after delimiter outside exec", () => { + expect(() => + assertScopedArgs([ + "get", + "pods/existing", + "-o", + "json", + "--", + "secrets/app-config", + ]), + ).toThrow(); +}); +test("partial cleanup accepts only the exclusive server owner nonce", () => { + expect(() => + assertPartialClaim( + { ...receipt, state: "claimed", nonce: "ours" }, + { container: receipt.container, owner: "foreign" }, + expected, + ), + ).toThrow(); +}); +test("partial cleanup never weakens a ready namespace guard", () => { + expect(() => + assertPartialClaim( + { ...receipt, state: "ready", nonce: "ours" }, + { container: receipt.container, owner: "ours" }, + expected, + ), + ).toThrow(); +}); +test("partial cleanup accepts an owned server before namespace creation", () => { + expect(() => + assertPartialClaim( + { lab: 3, cluster: expected.cluster, state: "claimed", nonce: "ours" }, + { container: "fresh-server", owner: "ours" }, + expected, + ), + ).not.toThrow(); +}); +test("rejects a running replacement process despite stale Kubernetes status", () => { + expect(() => + assertNoRunningContainers( + [{ id: "new-process", labels: { "io.kubernetes.pod.uid": "victim" } }], + "victim", + ), + ).toThrow(); +}); +test("accepts native absence of the victim process", () => { + expect(() => + assertNoRunningContainers( + [{ id: "survivor", labels: { "io.kubernetes.pod.uid": "other" } }], + "victim", + ), + ).not.toThrow(); +}); diff --git a/student-tests/kube-stdin.ts b/student-tests/kube-stdin.ts new file mode 100644 index 00000000..870310e1 --- /dev/null +++ b/student-tests/kube-stdin.ts @@ -0,0 +1,32 @@ +import { resolve } from "node:path"; +const root = resolve(import.meta.dir, ".."); +const p = Bun.spawn( + [ + resolve(root, "scripts/kube.sh"), + "exec", + "-i", + "deployment/postgres", + "--", + "psql", + "-X", + "-qAt", + "-U", + "messenger", + "-d", + "messenger", + "-v", + "ON_ERROR_STOP=1", + ], + { cwd: root, stdin: "pipe", stdout: "pipe", stderr: "pipe" }, +); +p.stdin.write("SELECT 'stdin-boundary-ok';\n"); +p.stdin.end(); +const [out, err] = await Promise.all([ + new Response(p.stdout).text(), + new Response(p.stderr).text(), +]); +if ((await p.exited) !== 0 || out.trim() !== "stdin-boundary-ok") + throw new Error("Kubernetes wrapper did not execute the stdin query"); +console.log( + "PASS: SQL stdin reaches PostgreSQL through the real scoped wrapper", +); diff --git a/student-tests/plot_research.py b/student-tests/plot_research.py new file mode 100644 index 00000000..9ff83039 --- /dev/null +++ b/student-tests/plot_research.py @@ -0,0 +1,74 @@ +"""Plot measured coursework results; this is data analysis, not application code.""" +import argparse +import json +from pathlib import Path +from statistics import mean + +import matplotlib +matplotlib.use('Agg') +import matplotlib.pyplot as plt + +parser = argparse.ArgumentParser() +parser.add_argument('summary', type=Path) +parser.add_argument('--pool-summary', type=Path) +args = parser.parse_args() +data = json.loads(args.summary.read_text()) +if data.get('complete') is not True: + raise SystemExit('Only a completed, cleaned-up run can be plotted') +plt.rcParams.update({'svg.fonttype': 'none', 'font.size': 10}) + +if 'dataset' in data: + fig, axes = plt.subplots(1, 2, figsize=(9, 3.5), constrained_layout=True) + modes = ['chat_only', 'history'] + for axis, key, title in zip(axes, ['read', 'write'], ['Deep history page (51 rows)', 'Insert 1,000 messages']): + values = [data['plans'][mode][key]['Execution Time'] for mode in modes] + axis.bar(['chat_id', 'chat_id + time + id'], values, color=['#6b7280', '#2563eb']) + axis.set_ylabel('Execution time, ms') + axis.set_title(title) + if key == 'read': + axis.set_yscale('log') + for index, value in enumerate(values): + axis.annotate(f'{value:.3f}', (index, value), xytext=(0, 4), textcoords='offset points', ha='center') + fig.suptitle('100,000 skewed messages; one EXPLAIN ANALYZE per index') + fig.savefig(args.summary.parent / 'comparison.svg') + plt.close(fig) +else: + if data.get('valid') is not True: + raise SystemExit('Invalid measurements') + rows = data['samples'] + fig, axes = plt.subplots(1, 2, figsize=(10, 3.8), constrained_layout=True) + for phase, label, color in [('fixed', 'Fixed total API CPU/RAM', '#2563eb'), ('growing', 'Resources grow with replicas', '#c2410c')]: + groups = [[r for r in rows if r['phase'] == phase and r['replicas'] == count] for count in [1, 2, 4]] + if not all(groups): + continue + for axis, metric in zip(axes, ['rps', 'p95']): + values = [[r['metrics']['successful_rps'] if metric == 'rps' else r['metrics']['successful_latency_ms']['p95'] for r in group] for group in groups] + centers = [mean(value) for value in values] + errors = [[center - min(value) for center, value in zip(centers, values)], [max(value) - center for center, value in zip(centers, values)]] + axis.errorbar([1, 2, 4], centers, yerr=errors, marker='o', capsize=4, label=label, color=color) + for axis, title in zip(axes, ['Successful requests / second', 'p95 of successful requests, ms']): + axis.set_title(title) + axis.set_xlabel('API replicas') + axis.set_xticks([1, 2, 4]) + axis.grid(alpha=.2) + axis.legend(fontsize=8) + fig.suptitle('Closed loop, concurrency 16, 5 seconds; mean and range of two runs') + fig.savefig(args.summary.parent / 'scaling.svg') + plt.close(fig) + pool_data = json.loads(args.pool_summary.read_text()) if args.pool_summary else data + if pool_data.get('complete') is not True: + raise SystemExit('Incomplete pool experiment') + pools = [[r for r in pool_data['samples'] if r['phase'] == 'pool' and r['pool'] == size] for size in [8, 1]] + fig, axes = plt.subplots(1, 2, figsize=(8, 3.5), constrained_layout=True) + for axis, metric in zip(axes, ['rps', 'p95']): + values = [[r['metrics']['successful_rps'] if metric == 'rps' else r['metrics']['successful_latency_ms']['p95'] for r in group] for group in pools] + centers = [mean(value) for value in values] + axis.bar(['pool = 8', 'pool = 1'], centers, color=['#6b7280', '#2563eb']) + axis.set_ylabel('Successful req/s' if metric == 'rps' else 'p95, ms') + axis.set_ylim(bottom=0) + for index, center in enumerate(centers): + axis.annotate(f'{center:.2f}', (index, center), xytext=(0, 4), textcoords='offset points', ha='center') + fig.suptitle('One hot sender; same single-replica CPU/RAM budget') + fig.savefig(args.summary.parent / 'pool.svg') + plt.close(fig) +print('Saved standalone SVG research figures') diff --git a/student-tests/requirements-plots.txt b/student-tests/requirements-plots.txt new file mode 100644 index 00000000..71363ac8 --- /dev/null +++ b/student-tests/requirements-plots.txt @@ -0,0 +1 @@ +matplotlib==3.11.2 diff --git a/student-tests/research-compose.ts b/student-tests/research-compose.ts new file mode 100644 index 00000000..84a5e5f4 --- /dev/null +++ b/student-tests/research-compose.ts @@ -0,0 +1,104 @@ +import {resolve} from 'node:path'; +import {mkdir,mkdtemp,writeFile} from 'node:fs/promises'; +const root=resolve(import.meta.dir,'..'); +if(process.argv.includes('--check')){console.log('Research script parsed without accessing the stand');process.exit(0);} +const nonce=crypto.randomUUID().slice(0,8),project='vp-lab3-research-'+nonce; +const parent=resolve(root,'evidence/research');await mkdir(parent,{recursive:true}); +const evidence=await mkdtemp(resolve(parent,'run-')); +await writeFile(resolve(evidence,'run.json'),JSON.stringify({run_id:nonce,started_at:new Date().toISOString(),state:'started',project})+'\n',{flag:'wx'}); +let stage='preflight',created=false,primary:unknown; +let rolling:Promise<{ok:boolean}>|undefined;let rollingFinished=false; +const cleanupErrors:string[]=[]; +let configuration:Record={PUBLIC_PORT:'28303',BASE_URL:'http://127.0.0.1:28303',SESSION_TTL_SECONDS:'3600'}; +const base='http://127.0.0.1:28303'; +async function command(args:string[],input?:string){ + const p=Bun.spawn(args,{cwd:root,env:{...process.env,...configuration},stdin:input===undefined?'ignore':'pipe',stdout:'pipe',stderr:'pipe',signal:AbortSignal.timeout(120000)}); + if(input!==undefined){p.stdin.write(input);p.stdin.end();} + const [out,err]=await Promise.all([new Response(p.stdout).text(),new Response(p.stderr).text()]); + if(await p.exited!==0)throw new Error(stage+': command failed ('+args[0]+')'); + return out; +} +async function guard(){const p=Bun.spawn(['/home/rey/.local/bin/game-running'],{stdout:'ignore',stderr:'pipe'});await new Response(p.stderr).text();if(await p.exited!==1)throw new Error('Research requires an inactive game');} +function compose(args:string[],input?:string){return command(['docker','compose','-f',resolve(root,'compose.yaml'),'-p',project,...args],input);} +async function sql(query:string){return compose(['exec','-T','postgres','psql','-X','-qAt','-U','messenger','-d','messenger','-v','ON_ERROR_STOP=1'],query);} +const samples:any[]=[]; +const poolOnly=process.argv.includes('--pool-only'); +let rollingMetric:unknown; +try{ + await guard(); + if((await command(['ss','-H','-ltn','sport = :28303'])).trim())throw new Error('Research port is occupied'); + stage='create_isolated_stand';created=true; + await compose(['up','-d','--wait','postgres','valkey']); + await compose(['run','--rm','migrate']); + const hardware=JSON.parse(await command(['lscpu','-J'])); + await writeFile(resolve(evidence,'hardware.json'),JSON.stringify(hardware.lscpu.filter((x:any)=>/Model name|CPU\(s\)|Thread|Core\(s\)/.test(x.field)),null,2)+'\n'); + const cases:any[]=[]; + if(!poolOnly)for(const phase of ['fixed','growing'])for(const replicas of [1,2,4])for(const repeat of [1,2])cases.push({phase,replicas,repeat,pool:8}); + // Pool experiment keeps the single-replica CPU/RAM budget identical. + for(const [index,pool] of [8,1,1,8].entries())cases.push({phase:'pool',replicas:1,repeat:index+1,pool}); + for(const test of cases){ + await guard();stage=`configure_${test.phase}_${test.replicas}_${test.repeat}_${test.pool}`; + await compose(['stop','api']); + await sql('TRUNCATE idempotency,messages,chat_members,chats,sessions,users;'); + const fixed=test.phase!=='growing'; + const memory=fixed?2048/test.replicas:512; + configuration={...configuration,API_REPLICAS:String(test.replicas),API_CPUS:String(fixed?2/test.replicas:1),API_MEMORY:memory+'m',GO_MEMORY_LIMIT:Math.floor(memory*.75)+'MiB',PG_MAX_CONNS:String(test.pool)}; + await compose(['up','-d','--no-build','--scale','api='+test.replicas,'api','lb']); + await command([process.execPath,'--no-env-file','student-tests/wait.ts'].map(String)); + const actual=await (await fetch(base+'/debug/stats')).json() as any; + if(actual.store?.pool_max!==test.pool)throw new Error('Running image did not apply the requested pool size'); + const replicaIDs=(await compose(['ps','-q','api'])).trim().split(/\s+/); + if(replicaIDs.length!==test.replicas)throw new Error('Actual replica count differs'); + for(const id of replicaIDs){const [cpuBytes,memoryBytes]=(await command(['docker','inspect','--format','{{.HostConfig.NanoCpus}} {{.HostConfig.Memory}}',id])).trim().split(/\s+/).map(Number);if(cpuBytes!==Number(configuration.API_CPUS)*1e9||memoryBytes!==memory*1024*1024)throw new Error('Actual API resource limits differ');} + // The wait helper needs this stand's endpoint explicitly. + stage='measure_'+test.phase; + const name=[test.phase,test.replicas,test.pool,test.repeat].join('-'); + const output=resolve(evidence,name+'.json'); + const ids=(await compose(['ps','-q','api','lb','postgres','valkey'])).trim().split(/\s+/); + const load=command(['python3','tests/load.py','--base-url',base,'--duration','5','--concurrency','16','--output',output]); + const snapshot=(async()=>{await Bun.sleep(2000);const text=await command(['docker','stats','--no-stream','--format','{{json .}}',...ids]);return text.trim().split('\n').filter(Boolean).map(line=>{const x=JSON.parse(line);return {name:x.Name,cpu_percent:x.CPUPerc,memory:x.MemUsage};});})(); + const waits=(async()=>{await Bun.sleep(1000);const out=[];for(let i=0;i<10;i++){out.push(JSON.parse((await sql("SELECT coalesce(json_agg(t),'[]'::json) FROM (SELECT wait_event_type,wait_event,count(*) FROM pg_stat_activity WHERE datname=current_database() AND state='active' AND pid<>pg_backend_pid() GROUP BY wait_event_type,wait_event) t; ")).trim()));await Bun.sleep(200);}return out;})(); + const measured=await Promise.allSettled([load,snapshot,waits]); + for(const result of measured)if(result.status==='rejected')throw result.reason; + const stats=(measured[1] as PromiseFulfilledResult).value; + const postgresWaits=(measured[2] as PromiseFulfilledResult).value; + await guard(); + const metric=await Bun.file(output).json(); + const count=Number((await sql('SELECT count(*) FROM messages;')).trim()); + samples.push({...test,api_cpu_each:Number(configuration.API_CPUS),api_memory_mb_each:memory,metrics:metric,snapshot:stats,postgres_wait_samples:postgresWaits,messages:count}); + await writeFile(resolve(evidence,'summary.json'),JSON.stringify({valid:true,complete:false,expected_samples:cases.length,profile:'closed-loop POST text, concurrency16,5seconds,2repetitions; fresh DB data for each run',samples},null,2)+'\n'); + } + if(!poolOnly){ + stage='rolling_update'; + await compose(['stop','api']);await sql('TRUNCATE idempotency,messages,chat_members,chats,sessions,users;'); + configuration={...configuration,API_REPLICAS:'2',API_CPUS:'1',API_MEMORY:'512m',GO_MEMORY_LIMIT:'384MiB',PG_MAX_CONNS:'8'}; + await compose(['up','-d','--no-build','--scale','api=2','api','lb']); + await command([process.execPath,'--no-env-file','student-tests/wait.ts']); + const ids=(await compose(['ps','-q','api'])).trim().split(/\s+/); + rolling=command(['python3','tests/load.py','--base-url',base,'--duration','30','--concurrency','8','--output',resolve(evidence,'rolling.json')]).then(()=>({ok:true}),()=>({ok:false})).finally(()=>{rollingFinished=true;}); + for(let attempt=0;attempt<100;attempt++){if(Number((await sql('SELECT count(*) FROM messages;')).trim())>10)break;await Bun.sleep(100);if(attempt===99)throw new Error('Rolling workload did not start');} + const replacements=[]; + for(const id of ids){ + if(rollingFinished)throw new Error('Workload ended before both replacements'); + const before=Number((await sql('SELECT count(*) FROM messages;')).trim()); + if((await command(['docker','inspect','--format','{{index .Config.Labels "com.docker.compose.project"}}',id])).trim()!==project)throw new Error('Replica ownership guard failed'); + await command(['docker','stop','--time','8',id]); + await command(['docker','container','rm',id]); + await compose(['up','-d','--no-build','--no-deps','--scale','api=2','api']); + await command([process.execPath,'--no-env-file','student-tests/wait.ts']); + const after=Number((await sql('SELECT count(*) FROM messages;')).trim()); + if(rollingFinished||after<=before)throw new Error('Replacement was not covered by successful writes'); + replacements.push({old_container:id.slice(0,12),messages_before:before,messages_after:after}); + } + if(!(await rolling).ok)throw new Error('Rolling load failed');await guard(); + await writeFile(resolve(evidence,'replacements.json'),JSON.stringify(replacements,null,2)+'\n'); + rollingMetric=await Bun.file(resolve(evidence,'rolling.json')).json(); + } +}catch(error){primary=error;} +finally{ + if(rolling)await rolling; + if(created)try{await compose(['down','--volumes']);}catch{cleanupErrors.push('isolated_stand');} +} +if(primary||cleanupErrors.length){await writeFile(resolve(evidence,'failure.json'),JSON.stringify({run_id:nonce,stage,primary:primary instanceof Error?primary.name:primary?'unknown':null,cleanup_errors:cleanupErrors})+'\n');throw new Error('Research failed; inspect this run failure summary');} +await writeFile(resolve(evidence,'summary.json'),JSON.stringify({run_id:nonce,valid:true,complete:true,expected_samples:poolOnly?4:16,profile:'closed-loop POST text, concurrency16,5seconds,2repetitions; fresh DB data for each run',samples,rolling:rollingMetric},null,2)+'\n'); +console.log('PASS lab3 research: '+evidence); diff --git a/student-tests/research.ts b/student-tests/research.ts new file mode 100644 index 00000000..902c379e --- /dev/null +++ b/student-tests/research.ts @@ -0,0 +1,374 @@ +import { resolve } from "node:path"; +import { mkdir, mkdtemp, writeFile } from "node:fs/promises"; +import { assertNoGame } from "../scripts/k3s-model"; +const root = resolve(import.meta.dir, ".."); +if (process.argv.includes("--check")) { + console.log("Parsed isolated k3s/Pingap research"); + process.exit(0); +} +const cluster = + "vp-lab3-r-" + crypto.randomUUID().replaceAll("-", "").slice(0, 8); +const base = "http://127.0.0.1:28303"; +let env = { + ...process.env, + VP_RUNTIME: "k3s", + VP_CLUSTER: cluster, + PUBLIC_PORT: "28303", + BASE_URL: base, + API_REPLICAS: "2", + API_CPUS: "1", + API_MEMORY: "512Mi", + GO_MEMORY_LIMIT: "400MiB", + PG_MAX_CONNS: "8", +}; +const parent = resolve(root, "evidence/k3s/research"); +await mkdir(parent, { recursive: true }); +const evidence = await mkdtemp(resolve(parent, "run-")); +await writeFile( + resolve(evidence, "run.json"), + JSON.stringify({ + cluster, + started_at: new Date().toISOString(), + state: "started", + }) + "\n", + { flag: "wx" }, +); +let stage = "preflight", + failureStage: string | undefined, + created = false, + primary: unknown; +const cleanupErrors: string[] = []; +let rolling: Promise | undefined, + finished = false; +async function command(label: string, args: string[], input?: string) { + stage = label; + const p = Bun.spawn(args, { + cwd: root, + env, + stdin: input === undefined ? "ignore" : "pipe", + stdout: "pipe", + stderr: "pipe", + signal: AbortSignal.timeout(360000), + }); + if (input !== undefined) { + p.stdin.write(input); + p.stdin.end(); + } + const [out, err] = await Promise.all([ + new Response(p.stdout).text(), + new Response(p.stderr).text(), + ]); + if ((await p.exited) !== 0) { + await writeFile(resolve(root, ".local/research-error.txt"), out + err, { + mode: 0o600, + }); + throw new Error(label + " failed"); + } + return out; +} +function stand(args: string[]) { + return command("stand_" + args[0], [ + process.execPath, + "--no-env-file", + "scripts/k3s.ts", + ...args, + ]); +} +function kube(args: string[], input?: string) { + return command( + "kubernetes_" + args[0], + [resolve(root, "scripts/kube.sh"), ...args], + input, + ); +} +function sql(query: string) { + return kube( + [ + "exec", + "-i", + "deployment/postgres", + "--", + "psql", + "-X", + "-qAt", + "-U", + "messenger", + "-d", + "messenger", + "-v", + "ON_ERROR_STOP=1", + ], + query, + ); +} +async function guard() { + const p = Bun.spawn(["game-running"], { stdout: "ignore", stderr: "pipe" }); + await new Response(p.stderr).text(); + assertNoGame(await p.exited); +} +const samples: any[] = []; +let rollingMetric: unknown; +const poolOnly = process.argv.includes("--pool-only"); +try { + await guard(); + created = true; + await stand(["up"]); + const hardware = JSON.parse(await command("hardware", ["lscpu", "-J"])); + await writeFile( + resolve(evidence, "hardware.json"), + JSON.stringify( + hardware.lscpu.filter((x: any) => + /Model name|CPU\(s\)|Thread|Core\(s\)/.test(x.field), + ), + null, + 2, + ) + "\n", + ); + const cases: any[] = []; + if (!poolOnly) + for (const phase of ["fixed", "growing"]) + for (const replicas of [1, 2, 4]) + for (const repeat of [1, 2]) + cases.push({ phase, replicas, repeat, pool: 8 }); + for (const [index, pool] of [8, 1, 1, 8].entries()) + cases.push({ phase: "pool", replicas: 1, repeat: index + 1, pool }); + let previous = ""; + for (const test of cases) { + await guard(); + const fixed = test.phase !== "growing", + memory = fixed ? 2048 / test.replicas : 512, + cpu = fixed ? 2 / test.replicas : 1; + env = { + ...env, + API_REPLICAS: String(test.replicas), + API_CPUS: String(cpu), + API_MEMORY: memory + "Mi", + GO_MEMORY_LIMIT: Math.floor(memory * 0.75) + "MiB", + PG_MAX_CONNS: String(test.pool), + }; + const configuration = [test.replicas, cpu, memory, test.pool].join("-"); + if (configuration !== previous) { + await stand(["configure"]); + previous = configuration; + } + // This cluster is exclusively owned by this experiment; no external clients are running. + await sql( + "TRUNCATE idempotency,messages,chat_members,chats,sessions,users;", + ); + const before = JSON.parse(await stand(["stats"])); + const cpuValue = (s: string) => + s.endsWith("m") ? Number(s.slice(0, -1)) / 1000 : Number(s); + const memoryValue = (s: string) => + s.endsWith("Gi") + ? Number(s.slice(0, -2)) * 1024 + : Number(s.replace(/Mi$/, "")); + if ( + before.pods.length !== test.replicas || + before.pods.some( + (p: any) => + cpuValue(p.limits.cpu) !== cpu || + memoryValue(p.limits.memory) !== memory, + ) + ) + throw new Error("Actual API count or resource budget differs"); + const response = await fetch(base + "/debug/stats", { + signal: AbortSignal.timeout(3000), + }); + const actual = (await response.json()) as any; + if (response.status !== 200 || actual.store?.pool_max !== test.pool) + throw new Error("Actual SQL pool differs"); + const name = [test.phase, test.replicas, test.pool, test.repeat].join("-"), + output = resolve(evidence, name + ".json"); + const load = command("load_" + name, [ + "python3", + "tests/load.py", + "--base-url", + base, + "--duration", + "5", + "--concurrency", + "16", + "--output", + output, + ]); + const snapshot = (async () => { + await Bun.sleep(2000); + return JSON.parse(await stand(["stats"])); + })(); + const waits = (async () => { + await Bun.sleep(1000); + const query = + "SELECT json_build_object('at',clock_timestamp(),'events',coalesce((SELECT json_agg(t) FROM (SELECT wait_event_type,wait_event,count(*) FROM pg_stat_activity WHERE datname=current_database() AND state='active' AND pid<>pg_backend_pid() GROUP BY wait_event_type,wait_event) t),'[]'::json))::jsonb::text;"; + const text = await sql( + Array.from( + { length: 10 }, + () => query + "\nSELECT pg_sleep(0.2);", + ).join("\n"), + ); + return text + .split("\n") + .filter((x) => x.startsWith("{")) + .map((x) => JSON.parse(x)); + })(); + const results = await Promise.allSettled([load, snapshot, waits]); + for (const r of results) if (r.status === "rejected") throw r.reason; + await guard(); + const metric = await Bun.file(output).json(); + const snapshotValue = (results[1] as PromiseFulfilledResult).value; + const messageCount = Number( + (await sql("SELECT count(*) FROM messages;")).trim(), + ); + if ( + !Number.isFinite(metric.successful_rps) || + metric.successful_rps <= 0 || + !Number.isFinite(metric.successful_latency_ms?.p95) || + !Number.isInteger(messageCount) || + messageCount < 1 + ) + throw new Error("No valid successful workload or persisted messages"); + if ( + snapshotValue.pods.length !== before.pods.length || + snapshotValue.pods.some( + (p: any) => !before.pods.some((b: any) => b.uid === p.uid), + ) + ) + throw new Error("API pods changed during measurement"); + samples.push({ + ...test, + api_cpu_each: cpu, + api_memory_mb_each: memory, + metrics: metric, + snapshot: snapshotValue, + postgres_wait_samples: (results[2] as PromiseFulfilledResult).value, + messages: messageCount, + }); + } + if (!poolOnly) { + env = { + ...env, + API_REPLICAS: "2", + API_CPUS: "1", + API_MEMORY: "512Mi", + GO_MEMORY_LIMIT: "384MiB", + PG_MAX_CONNS: "8", + }; + await stand(["configure"]); + await sql( + "TRUNCATE idempotency,messages,chat_members,chats,sessions,users;", + ); + const before = JSON.parse( + await kube(["get", "pods", "-l", "app=api", "-o", "json"]), + ).items.map((p: any) => ({ name: p.metadata.name, uid: p.metadata.uid })); + let loadFailure: unknown; + rolling = command("rolling_load", [ + "python3", + "tests/load.py", + "--base-url", + base, + "--duration", + "30", + "--concurrency", + "8", + "--output", + resolve(evidence, "rolling.json"), + ]) + .then( + () => {}, + (error) => { + loadFailure = error; + }, + ) + .finally(() => { + finished = true; + }); + for (let i = 0; i < 60; i++) { + if (Number((await sql("SELECT count(*) FROM messages;")).trim()) > 10) + break; + if (finished) throw new Error("Rolling load ended before starting"); + await Bun.sleep(100); + } + const countBefore = Number( + (await sql("SELECT count(*) FROM messages;")).trim(), + ); + if (countBefore <= 10) throw new Error("Rolling load did not start"); + await kube(["rollout", "restart", "deployment/api"]); + await stand(["ready"]); + const after = JSON.parse( + await kube(["get", "pods", "-l", "app=api", "-o", "json"]), + ).items.map((p: any) => ({ name: p.metadata.name, uid: p.metadata.uid })); + const countAfter = Number( + (await sql("SELECT count(*) FROM messages;")).trim(), + ); + if ( + finished || + countAfter <= countBefore || + after.length !== 2 || + after.some((p: any) => before.some((b: any) => b.uid === p.uid)) + ) + throw new Error("Rolling replacements not covered by continuing writes"); + await writeFile( + resolve(evidence, "replacements.json"), + JSON.stringify( + { + before, + after, + messages_before: countBefore, + messages_after: countAfter, + strategy: { maxSurge: 1, maxUnavailable: 0 }, + }, + null, + 2, + ) + "\n", + ); + await rolling; + if (loadFailure) throw loadFailure; + await guard(); + rollingMetric = await Bun.file(resolve(evidence, "rolling.json")).json(); + } +} catch (error) { + primary = error; + failureStage = stage; +} finally { + if (rolling) await rolling; + if (created) + try { + await stand(["destroy"]); + } catch { + cleanupErrors.push("isolated_cluster"); + } +} +if (primary || cleanupErrors.length) { + await writeFile( + resolve(evidence, "failure.json"), + JSON.stringify({ + stage: failureStage ?? stage, + primary: + primary instanceof Error ? primary.message : primary ? "unknown" : null, + cleanup_errors: cleanupErrors, + }) + "\n", + ); + throw new Error("Research failed; inspect this run"); +} +await writeFile( + resolve(evidence, "summary.json"), + JSON.stringify( + { + valid: true, + complete: true, + cluster, + runtime: "k3s1.37.1/Pingap0.16.0", + expected_samples: casesLength(), + profile: + "closed-loop POST text; concurrency16;5seconds;two repetitions;fresh data;single hot sender", + samples, + rolling: rollingMetric, + }, + null, + 2, + ) + "\n", + { flag: "wx" }, +); +function casesLength() { + return poolOnly ? 4 : 16; +} +console.log("PASS k3s/Pingap research: " + evidence); diff --git a/student-tests/restart-evidence.ts b/student-tests/restart-evidence.ts new file mode 100644 index 00000000..347050f1 --- /dev/null +++ b/student-tests/restart-evidence.ts @@ -0,0 +1,22 @@ +import { resolve } from "node:path"; +const root = resolve(import.meta.dir, ".."); +const before = await Bun.file( + resolve(root, "evidence/k3s/restart-before.json"), +).json(); +const after = await Bun.file( + resolve(root, "evidence/k3s/restart-after.json"), +).json(); +if ( + !before.run_id || + before.run_id !== after.run_id || + !Array.isArray(before.pods) || + !before.pods.length || + !Array.isArray(after.pods) || + !after.pods.length +) + throw new Error("Incomplete or mismatched restart evidence"); +if (after.pods.some((p: any) => before.pods.some((b: any) => b.uid === p.uid))) + throw new Error( + "Restart returned while an original workload Pod UID still existed", + ); +console.log("PASS: every recorded original workload Pod UID was replaced"); diff --git a/student-tests/wait.ts b/student-tests/wait.ts new file mode 100644 index 00000000..e2cb0cf0 --- /dev/null +++ b/student-tests/wait.ts @@ -0,0 +1,14 @@ +import {resolve} from 'node:path'; +const root=resolve(import.meta.dir,'..'); +const lab=(await Bun.file(resolve(root,'lab.json')).json()).number; +const base=process.env.BASE_URL??`http://127.0.0.1:${28200+lab}`; +const needed=lab>=3?Number(process.env.API_REPLICAS??2):1; +const instances=new Set(); +for(let attempt=0;attempt<600;attempt++){ + try{ + const r=await fetch(base+'/health/ready',{signal:AbortSignal.timeout(1000)});await r.arrayBuffer(); + if(r.status===200){instances.add(r.headers.get('X-Instance-Id')??'single');if(instances.size>=needed){console.log(`Ready: ${instances.size} API process(es)`);process.exit(0);}} + }catch{} + await Bun.sleep(150); +} +throw new Error('Stand readiness deadline expired'); -- 2.54.0