feat(ai): пилотные метрики ИИ-подсказок — POST /v1/ai/hint-metrics + админ-сводка
CI / test (push) Successful in 7m53s
CI / deploy-ift (push) Successful in 2m41s
CI / e2e-ift (push) Successful in 1m20s
CI / deploy-stage (push) Successful in 2m16s
CI / e2e-stage (push) Successful in 1m13s

Канон PRODUCT-AI (Spec#22): пилотные метрики L1-подсказок для расчёта
голосового гейта L2 (>=20% активных пользователей с >=2 подтверждённых
ghost-бронирований в месяц). Локальные счётчики в Mnesia, без LLM.

- таблица ai_hint_metric (миграция 20260820180000): счётчики
  {user, день UTC, pattern, kind}; ленивый prune при >500 строк на
  пользователя, retention 92 дня
- POST /v1/ai/hint-metrics (Bearer): батч <=20 событий shown/confirm/dismiss,
  202 {accepted:N}; ETS rate limit 30 req/min на пользователя
- GET /v1/admin/ai-metrics/stats (админ-порт): by_kind, active_users_30d,
  users_with_confirms_ge2_30d, gate_ratio_30d, top_patterns_by_confirm
- eunit logic_ai_metrics_tests (5/5); синхронизация списка миграций
  в migration_engine_tests

Refs EventHub/EventHubBack#78
This commit is contained in:
2026-08-20 18:35:29 +03:00
parent cc08b3b18a
commit f4d89a262c
11 changed files with 441 additions and 4 deletions
+12
View File
@@ -417,4 +417,16 @@
-record(schema_migration, {
version :: string(),
applied_at :: calendar:datetime()
}).
%% Пилотные метрики ИИ-подсказок (PRODUCT-AI, Spec#22): дневные счётчики
%% shown/confirm/dismiss по паттерну. Id = {user_id, day, pattern_key, kind}.
-record(ai_hint_metric, {
id :: {binary(), binary(), binary(), binary()},
user_id :: binary(),
day :: binary(),
pattern_key :: binary(),
kind :: binary(),
count :: non_neg_integer(),
updated_at :: calendar:datetime()
}).