refactor(api): TOML 配置 SSOT、统一错误契约、Auth/事务加固与可观测性 (#33)

配置 SSOT(TOML + .env)
统一错误契约
Auth 与事务边界
Redis / Celery 可靠性:业务 Redis(DB/0)与 Celery broker/backend(DB/1)显式拆分;连接池、sync client
可观测性(OpenTelemetry + LGTM)
This commit is contained in:
Sully
2026-05-22 13:44:50 +08:00
committed by GitHub
parent f09ae248f9
commit 53e0065e3e
298 changed files with 15247 additions and 4344 deletions

View File

@@ -4,6 +4,7 @@ import pytest
from app.core.config import settings
from app.core.llm_call import LLMCallError
from app.features.evaluation.constants import eval_cfg
from app.features.evaluation.conversation_compare_summary import (
build_conversation_compare_summary,
)
@@ -91,8 +92,8 @@ async def test_judge_conversation_wrapper_keeps_legacy_shape(
def test_eval_judge_transcript_budget_exceeds_legacy_8192(
monkeypatch: pytest.MonkeyPatch,
) -> None:
monkeypatch.setattr(settings, "eval_judge_max_transcript_chars", 0)
monkeypatch.setattr(settings, "eval_judge_context_window_tokens", 200_000)
monkeypatch.setattr(eval_cfg, "judge_max_transcript_chars", 0)
monkeypatch.setattr(eval_cfg, "judge_context_window_tokens", 200_000)
n = eval_judge_conversation_transcript_max_chars()
assert n > 90_000
each = eval_judge_compare_transcript_each_max_chars()
@@ -127,7 +128,7 @@ def test_trim_compare_transcript_pair_prefers_trimming_longer_side() -> None:
def test_eval_judge_transcript_budget_respects_explicit_cap(
monkeypatch: pytest.MonkeyPatch,
) -> None:
monkeypatch.setattr(settings, "eval_judge_max_transcript_chars", 12_000)
monkeypatch.setattr(eval_cfg, "judge_max_transcript_chars", 12_000)
assert eval_judge_conversation_transcript_max_chars() == 12_000