fix: V8.2.1 — 7 Befunde (A2 Caller, A3 Persistenz, A4 Strategie-Block, Tests, Feature-Flag, conftest, runbook)
Befund 1 (P0): A2 Dead-Code — _should_trigger_nachklaerung() in adapter.py Button-Response-Handler angebunden. stay_once (Button 3) triggert jetzt Nachklärung mit Strategie-Buttons. ARCHIVAR_CLARIFY-Responses werden verarbeitet (Strategie-Thema → Ring-Zustand "jetzt", ANDERER GRUND → normales Lernen). Befund 2 (P0): A3 Persistenz-Bug — _stay_counts und _keyword_last_matched in RoomMap.save() und _from_dict() serialisiert. Tracking-Felder überleben Gateway-Restart. Befund 3 (P1): A4 Strategie-Block — _is_strategie_topic() im DM-Pfad des Routers. Strategie-Themen im DM → stay_in_room (kein Routing, kein Lernen). Befund 4 (P1): Tests — 8 neue echte Integrationstests (TestV821A2, TestV821A3, TestV821A4). 27/27 grün. Befund 5 (P2): ARCHIVAR_STRATEGY_AUTO_DETECT env var in config.py, Default false (Rainer Auflage P1). Befund 6 (P2): conftest.py mit temp_room_map_path und temp_state_path Fixtures für saubere Pfad-Tests. Befund 7 (P2): docs/deployment-runbook.md mit .45 Bare-VM Schritten inkl. room-map.json Pfad-Korrektur.
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
"""
|
||||
V8.2.1: pytest-Fixtures für saubere Pfad-Tests.
|
||||
|
||||
Statt nested patches in jedem Test wird der room-map.json Pfad
|
||||
pro Test umgebogen. Verwendet tempfile.TemporaryDirectory für
|
||||
Isolation.
|
||||
"""
|
||||
|
||||
import json
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def temp_room_map_path():
|
||||
"""Erzeugt eine temporäre room-map.json mit minimalem Test-Setup.
|
||||
|
||||
Returns:
|
||||
Path: Pfad zur temporären room-map.json.
|
||||
"""
|
||||
tmp = tempfile.TemporaryDirectory()
|
||||
map_path = Path(tmp.name) / "room-map.json"
|
||||
|
||||
test_data = {
|
||||
"version": 2,
|
||||
"rooms": {
|
||||
"catchall_id": {
|
||||
"name": "#CatchAll",
|
||||
"theme": "Catch-all room",
|
||||
"keywords_100": [],
|
||||
"keywords_context": [],
|
||||
"catch_all": True,
|
||||
},
|
||||
"plugin_room_id": {
|
||||
"name": "#Rocketchat-Plugin",
|
||||
"theme": "Plugin-Entwicklung",
|
||||
"keywords_100": ["plugin"],
|
||||
"keywords_context": ["adapter"],
|
||||
"catch_all": False,
|
||||
},
|
||||
},
|
||||
"excluded_rooms": [],
|
||||
"fact_store_path": str(Path(tmp.name) / "docs"),
|
||||
}
|
||||
with open(map_path, "w") as f:
|
||||
json.dump(test_data, f)
|
||||
|
||||
yield map_path
|
||||
tmp.cleanup()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def temp_state_path():
|
||||
"""Erzeugt einen temporären Pfad für archivar_state.json.
|
||||
|
||||
Returns:
|
||||
str: Pfad zur temporären State-Datei.
|
||||
"""
|
||||
tmp = tempfile.TemporaryDirectory()
|
||||
state_path = str(Path(tmp.name) / "archivar_state.json")
|
||||
yield state_path
|
||||
tmp.cleanup()
|
||||
Reference in New Issue
Block a user