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
+5 -2
View File
@@ -100,7 +100,8 @@ ensure_indexes(Tables) when is_list(Tables) ->
{auth_session, [family_id, subject_id]},
{report, [resolved_by]},
{ticket, [assigned_to]},
{month_snapshot, [calendar_id, year_month]}
{month_snapshot, [calendar_id, year_month]},
{ai_hint_metric, [user_id, day]}
]),
ok.
@@ -207,7 +208,9 @@ table_opts(node_metric) ->
table_opts(schema_migration) ->
[{ram_copies, [node()]}, {attributes, record_info(fields, schema_migration)}];
table_opts(month_snapshot) ->
[{ram_copies, [node()]}, {attributes, record_info(fields, month_snapshot)}].
[{ram_copies, [node()]}, {attributes, record_info(fields, month_snapshot)}];
table_opts(ai_hint_metric) ->
[{ram_copies, [node()]}, {attributes, record_info(fields, ai_hint_metric)}].
%%%===================================================================
%%% Domain seeds