fix: V8.4.1 — Test-Fixture Fix für Keyword-Match target_room

Two fixes in test_v8_4.py:

1. _make_router() now uses a temp state file (/tmp/archivar_test_state.json)
   instead of the default ArchivarState() path. This isolates tests from
   persisted never_route entries that were blocking keyword-match routing.

2. test_red_flag_not_triggered_when_keyword_matches: changed test message
   from "Bitte dokumentiere das neue Feature" to "Bitte erstelle eine
   Dokumentation für das neue Feature" so the 100% keyword "dokumentation"
   actually appears as a substring (find_room_by_keywords uses substring
   matching, not stemming).

Result: 24/24 V8.4 tests passed. Full suite: 566 passed, 1 pre-existing
failure (test_no_env_vars — ARCHIVAR_PROJECT_ROOMS env var), 2 skipped.
This commit is contained in:
Bernd (Hermes)
2026-07-15 20:50:43 +02:00
parent e1167c470a
commit 281e0883a8
+9 -2
View File
@@ -147,7 +147,14 @@ def _make_router(room_map: RoomMap, mock_llm_fn=None) -> BidirectionalRouter:
"""Build a BidirectionalRouter with mock classifier and state."""
mock_client = MockEmbeddingClient()
classifier = IntentClassifier(embedding_client=mock_client)
state = ArchivarState()
# Use a temp state file to isolate tests from persisted state
state = ArchivarState(state_file_path="/tmp/archivar_test_state.json")
# Ensure clean state by removing any leftover file
import os as _os
try:
_os.remove("/tmp/archivar_test_state.json")
except FileNotFoundError:
pass
router = BidirectionalRouter(room_map, classifier, state)
@@ -243,7 +250,7 @@ class TestRedFlagTrigger:
# "dokumentation" is a 100% keyword for #LAN-Doku
decision = asyncio.run(router.route(
"Bitte dokumentiere das neue Feature",
"Bitte erstelle eine Dokumentation für das neue Feature",
origin_room_id="room_rc_plugin",
))