feat: V8.3.3 — Routing-Telemetrie (Konfidenz-Logging) + Echte Integration-Tests

FEATURE 1: Routing-Telemetrie (Konfidenz-Logging)
- Neue Datei: archivar/routing_telemetry.py — RoutingTelemetry Klasse
- Feature-Flag: ARCHIVAR_ROUTING_TELEMETRY env var (Default true)
- Pro Routing-Entscheidung: stage, score, decision, target, origin, duration_ms
- Format: [TELEMETRY] stage=keyword_100 score=1.00 decision=route ...
- NIEMALS Nachrichteninhalte im Log (Datenschutz)
- Telemetrie-Punkte in router.py an allen 5 Stufen:
  keyword_100, context_keyword, faiss, llm, default
- Flush in adapter.py nach classify_and_route()

FEATURE 2: Echte Integration-Tests
- Neue Datei: archivar/tests/test_v8_3_3.py (18 Tests)
- Echte RoutingDecision-Objekte statt Dict-Simulationen
- 7 Integration-Test-Klassen:
  1. 100%-Keyword im falschen Raum → route
  2. 100%-Keyword im richtigen Raum → stay (self-match)
  3. Kontext-Keyword → butler
  4. FAISS hohe Ähnlichkeit → route
  5. FAISS mittlere Ähnlichkeit → butler
  6. LLM → STAY
  7. LLM → ROUTE
- Telemetrie-Tests: Logging, Datenschutz, Feature-Flag
- Erweiterte conftest.py: multi_room_map, Mock-LLM Fixtures

Verifikation: 527 passed, 1 pre-existing fail, 2 skipped (FAISS)
This commit is contained in:
Bernd (Hermes)
2026-07-15 17:35:28 +02:00
parent 9acb11be68
commit 641b066db0
6 changed files with 829 additions and 0 deletions
+3
View File
@@ -47,6 +47,7 @@ if _MULTIROOM():
# Routing-Counter: immer importieren (keine schweren Abhängigkeiten)
from archivar.routing_counter import routing_counter
from archivar.routing_telemetry import routing_telemetry
# ── Access __init__ symbols (plugin loaded as flat module, no relative imports) ──
import sys as _sys
@@ -2027,6 +2028,8 @@ class RocketChatAdapter(BasePlatformAdapter):
else:
logger.debug("[rocketchat] ARCHIVAR-DEBUG: Calling classify_and_route for room=%s", room_id[:12])
decision = await self.archivar.classify_and_route(text, origin_room_id=room_id)
# V8.3.3: Telemetrie nach jeder Routing-Entscheidung flushen
routing_telemetry.flush()
if decision and decision.category:
category = decision.category
# Wenn Zielraum = Ursprungsraum → stay_in_room, kein Move-Request