fix: test_03 assertion, test_04 rate-limiting, onboarding reset on restart

AUFGABE 1 — test_03 flexible routing assertion:
- Ersetzt starre 'kopieren'/'rüber'-Prüfung durch flexible Keyword-Liste
  (wechseln, thema, sehe dich, move, raum, rüberkopieren, wechsel)
- Zusätzlich: Prüfung auf Zielraum-Namen (rc-test-automated, test-rc-target)
- Akzeptiert sowohl Move-Request-Buttons (Butler) als auch Auto-Route-Ankündigung

AUFGABE 2 — test_04 rate-limiting:
- 10s Pause vor Step 2 (rate-limit window reset nach test_03)
- Timeout von 25s auf 30s erhöht
- Polling-Intervall (sleep vor Projektraum-Check) von 2s auf 5s erhöht

AUFGABE 3 — Onboarding-Reset-Fix:
- Drei Stellen in adapter.py connect(): _start_onboarding([]) nur noch
  aufrufen wenn sm.state != OnboardingState.ACTIVE
- Verhindert dass onboarding.yaml bei jedem Gateway-Neustart auf
  AWAITING_ROOM zurückgesetzt wird, obwohl Onboarding abgeschlossen ist
This commit is contained in:
Bernd (Hermes)
2026-07-28 18:21:00 +02:00
parent 3f04373d0d
commit 41589818d2
3 changed files with 43 additions and 11 deletions
+20 -3
View File
@@ -108,9 +108,26 @@ def test_03_move_request(
logger.info("Test 03: bot move-request text: '%s'", move_req_text[:120])
posted_ids_source.append(move_req_msg.get("_id", ""))
# Verify the move-request contains expected elements
assert "kopieren" in move_req_text.lower() or "rüber" in move_req_text.lower(), (
f"Move-request message does not contain copy/rüber prompt: '{move_req_text[:200]}'"
# Verify the bot response is a valid routing action.
# Two valid forms:
# A) Move-Request with buttons (Butler mode): contains "kopieren" or "rüber"
# B) Auto-Route announcement (100% keyword / FAISS): contains "wechseln",
# "thema", "sehe dich", "move", "raum", or the target room name.
# Both are valid routing behaviors — the bot either asks for confirmation
# (Butler) or auto-routes with an announcement.
_routing_keywords = [
"kopieren", "rüber", "wechseln", "thema", "sehe dich",
"move", "raum", "rüberkopieren", "wechsel",
]
_has_routing_keyword = any(kw in move_req_text.lower() for kw in _routing_keywords)
_has_target_room = (
"rc-test-automated" in move_req_text.lower()
or "test-rc-target" in move_req_text.lower()
)
assert _has_routing_keyword or _has_target_room, (
f"Bot response is neither a move-request nor an auto-route announcement. "
f"Expected routing keywords ({_routing_keywords}) or target room name. "
f"Got: '{move_req_text[:200]}'"
)
# Step 3: Simulate button click — post MOVE_REQ:<source_room>::confirm_move
+5 -2
View File
@@ -91,13 +91,15 @@ def test_04_multi_room(
# Step 2: Wait for bot response in main room
# The bot should acknowledge the message (even if auto-routed)
# Pause 10s to let rate-limit window reset after test_03
time.sleep(10.0)
try:
bot_response = wait_for_bot_message(
client=rc_client,
room_id=test_room_id,
bot_username=bot_username,
cursor=main_cursor,
timeout=25.0,
timeout=30.0, # increased from 25s
rate_limiter=rate_limiter,
)
except RateLimitSkip as e:
@@ -120,7 +122,8 @@ def test_04_multi_room(
logger.info("Test 04: project room cursor = %s", project_cursor[:19])
# Give the Archivar a moment to complete the copy
time.sleep(2.0)
# Increased from 2s to 5s — fewer API calls, less rate-limit pressure
time.sleep(5.0)
try:
rate_limiter.acquire()