Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 10869697de | |||
| ee3bbf8ccf | |||
| a6d426d6e8 | |||
| 56e337fdc9 |
+17
-6
@@ -1789,6 +1789,13 @@ class RocketChatAdapter(BasePlatformAdapter):
|
|||||||
rid: {"name": info.get("name", ""), "type": info.get("type", "d")}
|
rid: {"name": info.get("name", ""), "type": info.get("type", "d")}
|
||||||
for rid, info in self._room_info.items()
|
for rid, info in self._room_info.items()
|
||||||
}
|
}
|
||||||
|
# F8: Onboarding State Machine laden (vor Bug-C-Check, damit SM-State verfügbar)
|
||||||
|
from archivar.onboarding_state import OnboardingStateMachine, OnboardingState
|
||||||
|
if not hasattr(self, '_onboarding_sm'):
|
||||||
|
self._onboarding_sm = OnboardingStateMachine()
|
||||||
|
self._onboarding_sm.load()
|
||||||
|
sm = self._onboarding_sm
|
||||||
|
|
||||||
# P1-4: Prüfe ob ein persistierter Onboarding-State existiert
|
# P1-4: Prüfe ob ein persistierter Onboarding-State existiert
|
||||||
persisted_onboarding = self.archivar._state.get_onboarding_state()
|
persisted_onboarding = self.archivar._state.get_onboarding_state()
|
||||||
if persisted_onboarding and persisted_onboarding.get("operator_room_id"):
|
if persisted_onboarding and persisted_onboarding.get("operator_room_id"):
|
||||||
@@ -1808,19 +1815,23 @@ class RocketChatAdapter(BasePlatformAdapter):
|
|||||||
logger.info("[rocketchat] P1-4: Persistierten Onboarding-State wiederhergestellt")
|
logger.info("[rocketchat] P1-4: Persistierten Onboarding-State wiederhergestellt")
|
||||||
self._onboarding_state = persisted_onboarding
|
self._onboarding_state = persisted_onboarding
|
||||||
self.archivar._stats["onboarding_active"] = True
|
self.archivar._stats["onboarding_active"] = True
|
||||||
|
elif sm.state == OnboardingState.ACTIVE:
|
||||||
|
# Fix 1: ACTIVE-Phase — Onboarding ist permanent fertig.
|
||||||
|
# archivar_state._onboarding_state darf leer bleiben
|
||||||
|
# (= kein laufendes Interview) — konsistent mit produktivem Pfad.
|
||||||
|
logger.info(
|
||||||
|
"[rocketchat] Bug C: Onboarding ACTIVE — archivar_state bleibt leer "
|
||||||
|
"(produktiver Pfad, kein laufendes Interview)"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
|
# Echte Zombie-Situation: Lock weg, Op-Raum weg,
|
||||||
|
# State noch nicht ACTIVE → State war mid-Interview.
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"[rocketchat] Bug C: Zombie-Onboarding-State verworfen — "
|
"[rocketchat] Bug C: Zombie-Onboarding-State verworfen — "
|
||||||
"op_room_subscribed=%s, lock_active=%s",
|
"op_room_subscribed=%s, lock_active=%s",
|
||||||
op_room_subscribed, lock_active,
|
op_room_subscribed, lock_active,
|
||||||
)
|
)
|
||||||
self.archivar._state.clear_onboarding_state()
|
self.archivar._state.clear_onboarding_state()
|
||||||
# F8: Onboarding State Machine laden und Restart-Logik prüfen
|
|
||||||
from archivar.onboarding_state import OnboardingStateMachine, OnboardingState
|
|
||||||
if not hasattr(self, '_onboarding_sm'):
|
|
||||||
self._onboarding_sm = OnboardingStateMachine()
|
|
||||||
self._onboarding_sm.load()
|
|
||||||
sm = self._onboarding_sm
|
|
||||||
if sm.state == OnboardingState.ACTIVE:
|
if sm.state == OnboardingState.ACTIVE:
|
||||||
logger.info("[rocketchat] F8: Onboarding bereits abgeschlossen — produktiver Pfad")
|
logger.info("[rocketchat] F8: Onboarding bereits abgeschlossen — produktiver Pfad")
|
||||||
elif sm.state == OnboardingState.ERROR:
|
elif sm.state == OnboardingState.ERROR:
|
||||||
|
|||||||
@@ -380,16 +380,32 @@ class OnboardingStateMachine:
|
|||||||
OnboardingState(self._data.current_state)
|
OnboardingState(self._data.current_state)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
invalid_state = self._data.current_state
|
invalid_state = self._data.current_state
|
||||||
logger.warning(
|
# Fix 3: Backwards-Compat für alte YAMLs mit COMPLETED
|
||||||
"Unbekannter State '%s' — setze auf ERROR",
|
if invalid_state == "COMPLETED":
|
||||||
invalid_state,
|
logger.info(
|
||||||
)
|
"Legacy-State 'COMPLETED' gefunden — mappe auf ACTIVE "
|
||||||
self._data.previous_state = OnboardingState.NONE.value # valid fallback
|
"(Backwards-Kompatibilität)"
|
||||||
self._data.current_state = OnboardingState.ERROR.value
|
)
|
||||||
self._data.error_message = (
|
self._data.previous_state = OnboardingState.NONE.value
|
||||||
f"Unbekannter State '{invalid_state}' gefunden. "
|
self._data.current_state = OnboardingState.ACTIVE.value
|
||||||
f"Bitte ::onboarding resume oder ::onboarding reset verwenden."
|
self._data.step_history.append({
|
||||||
)
|
"event": "legacy_migration",
|
||||||
|
"from": "COMPLETED",
|
||||||
|
"to": "ACTIVE",
|
||||||
|
"timestamp": time.time(),
|
||||||
|
"completed_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
logger.warning(
|
||||||
|
"Unbekannter State '%s' — setze auf ERROR",
|
||||||
|
invalid_state,
|
||||||
|
)
|
||||||
|
self._data.previous_state = OnboardingState.NONE.value # valid fallback
|
||||||
|
self._data.current_state = OnboardingState.ERROR.value
|
||||||
|
self._data.error_message = (
|
||||||
|
f"Unbekannter State '{invalid_state}' gefunden. "
|
||||||
|
f"Bitte ::onboarding resume oder ::onboarding reset verwenden."
|
||||||
|
)
|
||||||
|
|
||||||
self._loaded = True
|
self._loaded = True
|
||||||
logger.info(
|
logger.info(
|
||||||
@@ -470,11 +486,29 @@ class OnboardingStateMachine:
|
|||||||
|
|
||||||
def advance_test(self) -> bool:
|
def advance_test(self) -> bool:
|
||||||
"""FAKT-Speicherort gewählt → ACTIVE (abgeschlossen)."""
|
"""FAKT-Speicherort gewählt → ACTIVE (abgeschlossen)."""
|
||||||
return self._transition(OnboardingState.ACTIVE)
|
result = self._transition(OnboardingState.ACTIVE)
|
||||||
|
if result:
|
||||||
|
# Fix 2: completed_at-Timestamp für Audit/Debug
|
||||||
|
self._data.step_history.append({
|
||||||
|
"event": "completed",
|
||||||
|
"timestamp": time.time(),
|
||||||
|
"completed_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
|
||||||
|
})
|
||||||
|
self.save()
|
||||||
|
return result
|
||||||
|
|
||||||
def complete(self) -> bool:
|
def complete(self) -> bool:
|
||||||
"""Direkter Abschluss (Skip-All-Pfad): NONE → ACTIVE."""
|
"""Direkter Abschluss (Skip-All-Pfad): NONE → ACTIVE."""
|
||||||
return self._transition(OnboardingState.ACTIVE)
|
result = self._transition(OnboardingState.ACTIVE)
|
||||||
|
if result:
|
||||||
|
# Fix 2: completed_at-Timestamp für Audit/Debug
|
||||||
|
self._data.step_history.append({
|
||||||
|
"event": "completed",
|
||||||
|
"timestamp": time.time(),
|
||||||
|
"completed_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
|
||||||
|
})
|
||||||
|
self.save()
|
||||||
|
return result
|
||||||
|
|
||||||
def pause(self) -> bool:
|
def pause(self) -> bool:
|
||||||
"""Pausiert das Onboarding: beliebiger State → PAUSED."""
|
"""Pausiert das Onboarding: beliebiger State → PAUSED."""
|
||||||
|
|||||||
@@ -312,6 +312,9 @@ class TestOnboardingStepOffersChange:
|
|||||||
assert sm.state == OnboardingState.ACTIVE
|
assert sm.state == OnboardingState.ACTIVE
|
||||||
# step_history prüfen: kein Eintrag mit to="ACTIVE" von NONE
|
# step_history prüfen: kein Eintrag mit to="ACTIVE" von NONE
|
||||||
for entry in sm._data.step_history:
|
for entry in sm._data.step_history:
|
||||||
|
# Skip non-transition entries (e.g. completed events from Fix 2)
|
||||||
|
if "to" not in entry:
|
||||||
|
continue
|
||||||
if entry["to"] == "ACTIVE":
|
if entry["to"] == "ACTIVE":
|
||||||
assert entry["from"] != "NONE", (
|
assert entry["from"] != "NONE", (
|
||||||
"ACTIVE darf nicht direkt von NONE kommen (das wäre complete())"
|
"ACTIVE darf nicht direkt von NONE kommen (das wäre complete())"
|
||||||
|
|||||||
@@ -431,6 +431,83 @@ class TestRestartScenarios:
|
|||||||
assert sm.state == OnboardingState.ERROR
|
assert sm.state == OnboardingState.ERROR
|
||||||
assert "Unbekannter State" in sm._data.error_message
|
assert "Unbekannter State" in sm._data.error_message
|
||||||
|
|
||||||
|
def test_restart_preserves_active_state(self, tmp_state_path):
|
||||||
|
"""ACTIVE überlebt Restart — simuliert Plugin-Neustart.
|
||||||
|
|
||||||
|
Verifiziert dass nach complete() → ACTIVE ein erneutes load()
|
||||||
|
(simulierter Restart) den ACTIVE-State beibehält. Dies ist der
|
||||||
|
Test für den Onboarding-Reset-Fix: Bug-C-Logik in adapter.py
|
||||||
|
darf ACTIVE nicht als Zombie-State verwerfen.
|
||||||
|
"""
|
||||||
|
# Phase 1: Onboarding durchführen und abschließen
|
||||||
|
sm1 = OnboardingStateMachine(state_path=tmp_state_path)
|
||||||
|
sm1.load()
|
||||||
|
sm1.start(operator_room_id="dm1", missing_rooms=[
|
||||||
|
{"room_id": "r1", "name": "#Test"},
|
||||||
|
])
|
||||||
|
sm1.advance_room()
|
||||||
|
sm1.advance_intent()
|
||||||
|
sm1.advance_test()
|
||||||
|
assert sm1.state == OnboardingState.ACTIVE
|
||||||
|
assert sm1.is_done
|
||||||
|
|
||||||
|
# Phase 2: Restart simulieren — neue Instanz, gleiche Datei
|
||||||
|
sm2 = OnboardingStateMachine(state_path=tmp_state_path)
|
||||||
|
sm2.load()
|
||||||
|
assert sm2.state == OnboardingState.ACTIVE, (
|
||||||
|
f"ACTIVE sollte Restart überleben, ist aber {sm2.state.value}"
|
||||||
|
)
|
||||||
|
assert sm2.is_done
|
||||||
|
assert not sm2.is_active
|
||||||
|
|
||||||
|
# Phase 3: completed_at-Timestamp muss in step_history sein
|
||||||
|
completed_events = [
|
||||||
|
e for e in sm2._data.step_history
|
||||||
|
if e.get("event") == "completed"
|
||||||
|
]
|
||||||
|
assert len(completed_events) >= 1, (
|
||||||
|
"step_history muss mindestens einen 'completed'-Eintrag enthalten"
|
||||||
|
)
|
||||||
|
assert "completed_at" in completed_events[-1], (
|
||||||
|
"completed-Event muss 'completed_at'-Timestamp enthalten"
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_restart_completed_legacy_migration(self, tmp_state_path):
|
||||||
|
"""Legacy 'COMPLETED'-State wird beim Laden auf ACTIVE gemappt.
|
||||||
|
|
||||||
|
Alte YAMLs mit current_state='COMPLETED' (vor Fix 3) werden
|
||||||
|
beim Laden automatisch auf ACTIVE migriert, statt auf ERROR
|
||||||
|
zu fallen.
|
||||||
|
"""
|
||||||
|
os.makedirs(os.path.dirname(tmp_state_path), exist_ok=True)
|
||||||
|
data = {
|
||||||
|
"version": 1,
|
||||||
|
"schema_version": SCHEMA_VERSION,
|
||||||
|
"current_state": "COMPLETED",
|
||||||
|
"started_at": "2026-01-01T00:00:00Z",
|
||||||
|
"step_history": [],
|
||||||
|
}
|
||||||
|
with open(tmp_state_path, "w") as f:
|
||||||
|
yaml.dump(data, f)
|
||||||
|
|
||||||
|
sm = OnboardingStateMachine(state_path=tmp_state_path)
|
||||||
|
sm.load()
|
||||||
|
assert sm.state == OnboardingState.ACTIVE, (
|
||||||
|
f"COMPLETED sollte auf ACTIVE gemappt werden, ist aber {sm.state.value}"
|
||||||
|
)
|
||||||
|
assert sm.is_done
|
||||||
|
|
||||||
|
# Migration-Event muss in step_history sein
|
||||||
|
migration_events = [
|
||||||
|
e for e in sm._data.step_history
|
||||||
|
if e.get("event") == "legacy_migration"
|
||||||
|
]
|
||||||
|
assert len(migration_events) >= 1, (
|
||||||
|
"step_history muss einen 'legacy_migration'-Eintrag enthalten"
|
||||||
|
)
|
||||||
|
assert migration_events[0]["from"] == "COMPLETED"
|
||||||
|
assert migration_events[0]["to"] == "ACTIVE"
|
||||||
|
|
||||||
|
|
||||||
# ═══════════════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||||||
# Backup-Logik
|
# Backup-Logik
|
||||||
@@ -731,10 +808,16 @@ class TestStepHistory:
|
|||||||
sm.advance_test()
|
sm.advance_test()
|
||||||
|
|
||||||
history = sm._data.step_history
|
history = sm._data.step_history
|
||||||
assert len(history) == 4 # NONE→AWAITING_ROOM, →INTENT, →TEST, →ACTIVE
|
# 4 transitions (NONE→ROOM, ROOM→INTENT, INTENT→TEST, TEST→ACTIVE)
|
||||||
|
# + 1 completed event (Fix 2) = 5 entries
|
||||||
|
assert len(history) == 5
|
||||||
assert history[0]["from"] == "NONE"
|
assert history[0]["from"] == "NONE"
|
||||||
assert history[0]["to"] == "AWAITING_ROOM"
|
assert history[0]["to"] == "AWAITING_ROOM"
|
||||||
assert history[-1]["to"] == "ACTIVE"
|
# Last transition entry (index 3) is TEST→ACTIVE
|
||||||
|
assert history[3]["to"] == "ACTIVE"
|
||||||
|
# Last entry is the completed event
|
||||||
|
assert history[4]["event"] == "completed"
|
||||||
|
assert "completed_at" in history[4]
|
||||||
|
|
||||||
def test_history_includes_timestamps(self, sm):
|
def test_history_includes_timestamps(self, sm):
|
||||||
sm.load()
|
sm.load()
|
||||||
|
|||||||
@@ -7,23 +7,28 @@ Räume:
|
|||||||
- Target: test-rc-target (RC_LIVE_TARGET_ROOM)
|
- Target: test-rc-target (RC_LIVE_TARGET_ROOM)
|
||||||
- Haupt-Testraum: rc-test-automated (RC_LIVE_TEST_ROOM)
|
- Haupt-Testraum: rc-test-automated (RC_LIVE_TEST_ROOM)
|
||||||
|
|
||||||
Test-Szenario:
|
Test-Szenario (echter Button-Move-Request-Pfad):
|
||||||
1. Bernd postet in test-rc-source eine Nachricht mit Keyword 'rocketchat'
|
1. /reset an source_room senden (sticky-topic clear)
|
||||||
2. Bot erkennt Keyword, sendet Move-Request mit Buttons in test-rc-source
|
2. Context-Keyword-Text posten, der einen Room-Match via keywords_context
|
||||||
3. Bernd sendet Button-Klick-Payload via REST (MOVE_REQ:<rid>::confirm_move)
|
triggert (z.B. "hermes deployment pipeline" → #Rocketchat-Plugin)
|
||||||
4. Bot kopiert Nachricht nach test-rc-target
|
3. Bot sendet Move-Request-Buttons in source_room (butler_mode=cognitive)
|
||||||
5. Bernd liest test-rc-target via channels.history und verifiziert die kopierte Nachricht
|
4. Button-Payload "MOVE_REQ:<source_room_id>::confirm_move" via REST posten
|
||||||
|
5. Warten auf kopierte Nachricht im Zielraum (#Rocketchat-Plugin)
|
||||||
|
6. Verifizieren: kopierte Nachricht enthält "(Auftrag von @" + Original-Keyword
|
||||||
|
|
||||||
|
BUTLER-MODE-GUARD:
|
||||||
|
- Wenn butler_mode=off → pytest.skip mit klarer Meldung.
|
||||||
|
Der Test verifiziert den echten Button-Move-Request-Pfad, nicht Auto-Route.
|
||||||
|
|
||||||
ENV-Vars:
|
ENV-Vars:
|
||||||
- RC_LIVE_SOURCE_ROOM=6a68c21ddee04395ed6f5415
|
- RC_LIVE_SOURCE_ROOM=6a68c21ddee04395ed6f5415
|
||||||
- RC_LIVE_TARGET_ROOM=6a68c21ddee04395ed6f5419
|
- RC_LIVE_TARGET_ROOM=6a68c21ddee04395ed6f5419
|
||||||
|
- RC_LIVE_ROCKETCHAT_PLUGIN_ROOM (optional, default aus room-map.json)
|
||||||
|
|
||||||
RATE-LIMIT OPTIMIERUNG:
|
RATE-LIMIT OPTIMIERUNG:
|
||||||
- Kein separater get_latest_timestamp für source — nutzt den TS aus post_message
|
- Kein separater get_latest_timestamp für source — nutzt den TS aus post_message
|
||||||
- Polling source: initial_interval=5s (statt 2s)
|
- Polling source: initial_interval=5s (statt 2s)
|
||||||
- Polling target: timeout=60s, initial_interval=8s
|
- Polling target: timeout=60s, initial_interval=8s
|
||||||
- Auto-Route-Erkennung: wenn Bot auto-routet (100% keyword match), wird
|
|
||||||
kein Button-Klick simuliert und keine Target-Verifikation erwartet
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
@@ -47,6 +52,9 @@ from tests.live_rc.helpers.polling import (
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
# Room ID for #Rocketchat-Plugin from room-map.json (fallback if env var not set)
|
||||||
|
_DEFAULT_ROCKETCHAT_PLUGIN_ROOM = "6a19b0ff02aeecd36b1aa16c"
|
||||||
|
|
||||||
|
|
||||||
def _get_env_room(name: str) -> str:
|
def _get_env_room(name: str) -> str:
|
||||||
"""Get a room ID from env var, skip test if not set."""
|
"""Get a room ID from env var, skip test if not set."""
|
||||||
@@ -56,6 +64,50 @@ def _get_env_room(name: str) -> str:
|
|||||||
return val
|
return val
|
||||||
|
|
||||||
|
|
||||||
|
def _get_butler_mode(rc_client) -> str:
|
||||||
|
"""Read butler_mode from env var or detect from bot.
|
||||||
|
|
||||||
|
Priority:
|
||||||
|
1. RC_LIVE_BUTLER_MODE env var (explicit override)
|
||||||
|
2. Default: 'cognitive' (room_map.py default)
|
||||||
|
|
||||||
|
Returns 'cognitive', 'strict', or 'off'.
|
||||||
|
"""
|
||||||
|
env_mode = (os.getenv("RC_LIVE_BUTLER_MODE") or "").strip().lower()
|
||||||
|
if env_mode in ("cognitive", "strict", "off"):
|
||||||
|
return env_mode
|
||||||
|
# Default: cognitive (room_map.py line 192)
|
||||||
|
return "cognitive"
|
||||||
|
|
||||||
|
|
||||||
|
def _has_move_request_indicator(msg: dict) -> bool:
|
||||||
|
"""Check if a bot message contains a move-request indicator.
|
||||||
|
|
||||||
|
Looks for:
|
||||||
|
- Button attachments (rc-action-block with type=button)
|
||||||
|
- Text indicators: 'rüber', 'kopieren', 'verschieben', 'move'
|
||||||
|
"""
|
||||||
|
text = (msg.get("msg") or "").lower()
|
||||||
|
|
||||||
|
# Text-based indicators
|
||||||
|
text_indicators = ["rüber", "kopieren", "verschieben", "move"]
|
||||||
|
if any(ind in text for ind in text_indicators):
|
||||||
|
return True
|
||||||
|
|
||||||
|
# Button attachment check
|
||||||
|
attachments = msg.get("attachments", [])
|
||||||
|
for att in attachments:
|
||||||
|
if att.get("type") == "rc-action-block":
|
||||||
|
return True
|
||||||
|
# Some bots use actionButtons in the attachment
|
||||||
|
actions = att.get("actions", [])
|
||||||
|
for action in actions:
|
||||||
|
if action.get("type") == "button":
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.live_rc
|
@pytest.mark.live_rc
|
||||||
def test_03_move_request(
|
def test_03_move_request(
|
||||||
rc_client,
|
rc_client,
|
||||||
@@ -66,25 +118,43 @@ def test_03_move_request(
|
|||||||
cleanup_messages,
|
cleanup_messages,
|
||||||
bot_status_check,
|
bot_status_check,
|
||||||
):
|
):
|
||||||
"""Move-Flow: Bot erkennt Move-Request und routet in Zielraum.
|
"""Move-Flow: Bot erkennt Context-Keyword und sendet Move-Request-Buttons.
|
||||||
|
|
||||||
Steps:
|
Verifiziert den echten Button-Move-Request-Pfad:
|
||||||
1. Poste Keyword-Nachricht in Source-Room
|
1. Context-Keyword triggert Butler-Mode (nicht 100%-Auto-Route)
|
||||||
2. Warte auf Move-Request-Buttons vom Bot in Source-Room
|
2. Bot sendet Move-Request-Buttons im Source-Room
|
||||||
3. Simuliere Button-Klick (MOVE_REQ:<rid>::confirm_move) in Source-Room
|
3. Button-Klick (confirm_move) kopiert Nachricht in Zielraum
|
||||||
4. Warte auf kopierte Nachricht in Target-Room
|
4. Zielraum enthält kopierte Nachricht mit "(Auftrag von @..."-Präfix
|
||||||
5. Verifiziere: kopierte Nachricht enthält Original-Text + Präfix
|
|
||||||
|
BUTLER-MODE-GUARD: Wenn butler_mode=off, wird der Test mit einer
|
||||||
|
klaren Meldung geskippt — der Button-Pfad ist dann nicht verfügbar.
|
||||||
"""
|
"""
|
||||||
source_room = _get_env_room("RC_LIVE_SOURCE_ROOM")
|
source_room = _get_env_room("RC_LIVE_SOURCE_ROOM")
|
||||||
target_room = _get_env_room("RC_LIVE_TARGET_ROOM")
|
target_room = _get_env_room("RC_LIVE_TARGET_ROOM")
|
||||||
|
|
||||||
|
# Zielraum für die Kopie: #Rocketchat-Plugin (aus room-map.json)
|
||||||
|
rocket_chat_plugin_room = (
|
||||||
|
os.getenv("RC_LIVE_ROCKETCHAT_PLUGIN_ROOM") or _DEFAULT_ROCKETCHAT_PLUGIN_ROOM
|
||||||
|
).strip()
|
||||||
|
|
||||||
posted_ids_source: list = []
|
posted_ids_source: list = []
|
||||||
posted_ids_target: list = []
|
posted_ids_target: list = []
|
||||||
|
|
||||||
# Pre-step: Send /reset to clear sticky topics from previous tests.
|
# ── Butler-Mode-Guard ──────────────────────────────────────────────
|
||||||
# Previous tests (test_02, etc.) may have set a sticky topic on
|
# Wenn butler_mode=off, kann der Bot keine Move-Request-Buttons senden.
|
||||||
# rc-test-automated, which would cause the bot to auto-route there
|
# Der Test soll dann sauber skippen, nicht failen.
|
||||||
# instead of test-rc-target. /reset clears all sticky state.
|
butler_mode = _get_butler_mode(rc_client)
|
||||||
|
if butler_mode == "off":
|
||||||
|
pytest.skip(
|
||||||
|
"butler_mode=off — kein Button-Move-Request möglich. "
|
||||||
|
"Der Test verifiziert den echten Button-Pfad, nicht Auto-Route. "
|
||||||
|
"Setze butler_mode=cognitive oder strict um den Test auszuführen."
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Pre-step: /reset an source_room senden ─────────────────────────
|
||||||
|
# Clear sticky topics from previous tests. Previous tests (test_02, etc.)
|
||||||
|
# may have set a sticky topic that would cause auto-routing instead of
|
||||||
|
# butler mode.
|
||||||
_reset_msg_id, _ = post_test_message(
|
_reset_msg_id, _ = post_test_message(
|
||||||
rc_client, source_room, "/reset",
|
rc_client, source_room, "/reset",
|
||||||
posted_ids_source, rate_limiter,
|
posted_ids_source, rate_limiter,
|
||||||
@@ -94,115 +164,77 @@ def test_03_move_request(
|
|||||||
_reset_msg_id[:12],
|
_reset_msg_id[:12],
|
||||||
)
|
)
|
||||||
# Give the bot 5 seconds to process /reset AND send its response
|
# Give the bot 5 seconds to process /reset AND send its response
|
||||||
# before posting the keyword. The /reset response ("Konversation
|
# before posting the keyword. The /reset response must arrive BEFORE
|
||||||
# zurückgesetzt...") must arrive BEFORE the keyword post so that
|
# the keyword post so that source_cursor sits AFTER the /reset response.
|
||||||
# source_cursor (from the keyword post_message return) sits AFTER
|
|
||||||
# the /reset response. Otherwise wait_for_bot_message picks up the
|
|
||||||
# /reset response as a "move-request" and the assertion fails.
|
|
||||||
time.sleep(5.0)
|
time.sleep(5.0)
|
||||||
|
|
||||||
# Step 1: Post keyword message in source room.
|
# ── Step 1: Post context-keyword message in source room ─────────────
|
||||||
# SKIP separate get_latest_timestamp — use the timestamp from post_message
|
# Use a context keyword (NOT 100% keyword) to trigger butler mode.
|
||||||
# as cursor. Saves one channels.history API call.
|
# "hermes" + "deployment" are keywords_context for #Rocketchat-Plugin.
|
||||||
keyword_text = "rocketchat Test Move-Request — bitte in den Zielraum routen"
|
# 100% keywords like "rocketchat" would auto-route (move_request_sent=False).
|
||||||
|
keyword_text = (
|
||||||
|
"hermes deployment pipeline — bitte in den Rocketchat-Plugin-Raum routen"
|
||||||
|
)
|
||||||
|
|
||||||
msg_id, source_cursor = post_test_message(
|
msg_id, source_cursor = post_test_message(
|
||||||
rc_client, source_room, keyword_text,
|
rc_client, source_room, keyword_text,
|
||||||
posted_ids_source, rate_limiter,
|
posted_ids_source, rate_limiter,
|
||||||
)
|
)
|
||||||
logger.info(
|
logger.info(
|
||||||
"Test 03: posted keyword message %s in source room (cursor=%s)",
|
"Test 03: posted context-keyword message %s in source room (cursor=%s)",
|
||||||
msg_id[:12], source_cursor[:19],
|
msg_id[:12], source_cursor[:19],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Step 2: Wait for bot to send move-request buttons in source room.
|
# ── Step 2: Wait for bot to send move-request buttons ───────────────
|
||||||
# Use initial_interval=5s to reduce API call density (was 2s).
|
# Use initial_interval=5s to reduce API call density.
|
||||||
try:
|
try:
|
||||||
move_req_msg = wait_for_bot_message(
|
move_req_msg = wait_for_bot_message(
|
||||||
client=rc_client,
|
client=rc_client,
|
||||||
room_id=source_room,
|
room_id=source_room,
|
||||||
bot_username=bot_username,
|
bot_username=bot_username,
|
||||||
cursor=source_cursor,
|
cursor=source_cursor,
|
||||||
timeout=30.0, # Archivar needs time to classify + send buttons
|
timeout=30.0,
|
||||||
rate_limiter=rate_limiter,
|
rate_limiter=rate_limiter,
|
||||||
initial_interval=5.0,
|
initial_interval=5.0,
|
||||||
)
|
)
|
||||||
except RateLimitSkip as e:
|
except RateLimitSkip as e:
|
||||||
pytest.skip(f"Rate limit triggered: {e}")
|
pytest.skip(f"Rate limit triggered: {e}")
|
||||||
except PollTimeout as e:
|
except PollTimeout as e:
|
||||||
|
# Check if butler_mode is actually off (runtime check)
|
||||||
pytest.fail(
|
pytest.fail(
|
||||||
f"Bot did not send move-request buttons in source room within 30s. "
|
f"Bot did not send move-request buttons in source room within 30s. "
|
||||||
f"Check that the Archivar is running and the keyword 'rocketchat' "
|
f"Check that butler_mode is not 'off' and the Archivar is running. "
|
||||||
f"matches the target room. Error: {e}"
|
f"Context keyword: 'hermes deployment pipeline'. Error: {e}"
|
||||||
)
|
)
|
||||||
|
|
||||||
move_req_text = move_req_msg.get("msg", "")
|
move_req_text = move_req_msg.get("msg", "")
|
||||||
logger.info("Test 03: bot move-request text: '%s'", move_req_text[:120])
|
logger.info("Test 03: bot move-request text: '%s'", move_req_text[:200])
|
||||||
posted_ids_source.append(move_req_msg.get("_id", ""))
|
posted_ids_source.append(move_req_msg.get("_id", ""))
|
||||||
|
|
||||||
# Verify the bot response is a valid routing action.
|
# ── Assertion A: Move-Request-Indikator ────────────────────────────
|
||||||
# Two valid forms:
|
# The bot response must contain a move-request indicator:
|
||||||
# A) Move-Request with buttons (Butler mode): contains "kopieren" or "rüber"
|
# either button attachments or text like "rüber"/"kopieren"/"verschieben"
|
||||||
# B) Auto-Route announcement (100% keyword / FAISS): contains "wechseln",
|
assert _has_move_request_indicator(move_req_msg), (
|
||||||
# "thema", "sehe dich", "move", "raum", or the target room name.
|
f"Bot response is not a move-request. "
|
||||||
# Both are valid routing behaviors — the bot either asks for confirmation
|
f"Expected button attachment or text indicator "
|
||||||
# (Butler) or auto-routes with an announcement.
|
f"('rüber'/'kopieren'/'verschieben'/'move'). "
|
||||||
_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]}'"
|
f"Got: '{move_req_text[:200]}'"
|
||||||
)
|
)
|
||||||
|
|
||||||
# AUFGABE 4: Detect auto-route vs. button-move-request.
|
# ── Step 3: Get target cursor BEFORE posting button payload ────────
|
||||||
# Auto-route keywords: "wechseln", "sehe dich", "thema" — bot already
|
# The copy lands in #Rocketchat-Plugin room, not test-rc-target.
|
||||||
# routed the message, no button click needed, no copy to target expected.
|
# We use the rocket_chat_plugin_room for verification.
|
||||||
# PRIORITY: auto-route keywords take precedence over button keywords
|
target_cursor = get_latest_timestamp(
|
||||||
# and attachments. An auto-route announcement may have a room link card
|
rc_client, rocket_chat_plugin_room, rate_limiter=rate_limiter
|
||||||
# (attachment), but it's still an auto-route — skip immediately.
|
)
|
||||||
_auto_route_keywords = ["wechseln", "sehe dich", "thema"]
|
logger.info(
|
||||||
_is_auto_route = any(kw in move_req_text.lower() for kw in _auto_route_keywords)
|
"Test 03: target cursor (Rocketchat-Plugin room) = %s",
|
||||||
|
target_cursor[:19],
|
||||||
if _is_auto_route:
|
)
|
||||||
# Bot auto-routed (100% keyword match) — no button click needed,
|
|
||||||
# no copy to target expected. This is valid bot behavior.
|
|
||||||
# Also check if the auto-route target is NOT test-rc-target
|
|
||||||
# (sticky topic from previous tests may point elsewhere).
|
|
||||||
_target_is_wrong = (
|
|
||||||
"rc-test-automated" in move_req_text.lower()
|
|
||||||
and "test-rc-target" not in move_req_text.lower()
|
|
||||||
)
|
|
||||||
if _target_is_wrong:
|
|
||||||
logger.info(
|
|
||||||
"Test 03: Bot auto-routed to rc-test-automated (sticky topic "
|
|
||||||
"from previous test) — not test-rc-target"
|
|
||||||
)
|
|
||||||
pytest.skip(
|
|
||||||
"Bot has sticky topic on rc-test-automated from previous test. "
|
|
||||||
"Run /reset in source room before test_03 to clear sticky topics."
|
|
||||||
)
|
|
||||||
logger.info(
|
|
||||||
"Test 03: Bot auto-routed (100%% keyword match) — "
|
|
||||||
"no button click needed, skipping target verification"
|
|
||||||
)
|
|
||||||
pytest.skip(
|
|
||||||
"Bot auto-routed (100% keyword match), no copy to target expected"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Step 3: Simulate button click — post MOVE_REQ:<source_room>::confirm_move
|
|
||||||
# This is the payload the bot's native button sends when clicked.
|
|
||||||
# The adapter parses it at line 2395-2396 and routes to confirm_move handler.
|
|
||||||
target_cursor = get_latest_timestamp(rc_client, target_room, rate_limiter=rate_limiter)
|
|
||||||
logger.info("Test 03: target cursor = %s", target_cursor[:19])
|
|
||||||
|
|
||||||
|
# ── Step 4: Simulate button click — post MOVE_REQ payload ──────────
|
||||||
|
# Format: MOVE_REQ:<source_room_id>::confirm_move
|
||||||
|
# "confirm_move" maps to "✅Ja" (rüberkopieren) in adapter.py:2494
|
||||||
button_payload = f"MOVE_REQ:{source_room}::confirm_move"
|
button_payload = f"MOVE_REQ:{source_room}::confirm_move"
|
||||||
button_msg_id, _ = post_test_message(
|
button_msg_id, _ = post_test_message(
|
||||||
rc_client, source_room, button_payload,
|
rc_client, source_room, button_payload,
|
||||||
@@ -213,15 +245,13 @@ def test_03_move_request(
|
|||||||
button_payload[:60], button_msg_id[:12],
|
button_payload[:60], button_msg_id[:12],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Step 4: Wait for copied message in target room.
|
# ── Step 5: Wait for copied message in target room ──────────────────
|
||||||
# The bot posts: "*(Auftrag von @bernd, hierher kopiert)*\n<original text>"
|
# The bot posts: "*(Auftrag von @bernd, hierher kopiert)*\n<original text>"
|
||||||
# Use timeout=60s and initial_interval=8s to reduce API call density.
|
# in the #Rocketchat-Plugin room.
|
||||||
# The 429 retry in rc_rest.py now has 5 retries (71s total), so a single
|
|
||||||
# 429 on the target room won't kill the test.
|
|
||||||
try:
|
try:
|
||||||
copied_msg = wait_for_bot_message(
|
copied_msg = wait_for_bot_message(
|
||||||
client=rc_client,
|
client=rc_client,
|
||||||
room_id=target_room,
|
room_id=rocket_chat_plugin_room,
|
||||||
bot_username=bot_username,
|
bot_username=bot_username,
|
||||||
cursor=target_cursor,
|
cursor=target_cursor,
|
||||||
timeout=60.0,
|
timeout=60.0,
|
||||||
@@ -232,8 +262,8 @@ def test_03_move_request(
|
|||||||
pytest.skip(f"Rate limit triggered: {e}")
|
pytest.skip(f"Rate limit triggered: {e}")
|
||||||
except PollTimeout as e:
|
except PollTimeout as e:
|
||||||
pytest.fail(
|
pytest.fail(
|
||||||
f"Bot did not copy message to target room within 60s. "
|
f"Bot did not copy message to Rocketchat-Plugin room within 60s. "
|
||||||
f"Check that the bot is subscribed to the target room and "
|
f"Check that the bot is subscribed to the room and "
|
||||||
f"the move-request handler is working. Error: {e}"
|
f"the move-request handler is working. Error: {e}"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -241,24 +271,39 @@ def test_03_move_request(
|
|||||||
logger.info("Test 03: copied message in target: '%s'", copied_text[:200])
|
logger.info("Test 03: copied message in target: '%s'", copied_text[:200])
|
||||||
posted_ids_target.append(copied_msg.get("_id", ""))
|
posted_ids_target.append(copied_msg.get("_id", ""))
|
||||||
|
|
||||||
# Step 5: Verify the copied message
|
# ── Assertion B: Copied message has correct prefix + keyword ───────
|
||||||
# Should contain the prefix and the original keyword text
|
|
||||||
assert "Auftrag von" in copied_text or "hierher kopiert" in copied_text, (
|
assert "Auftrag von" in copied_text or "hierher kopiert" in copied_text, (
|
||||||
f"Copied message missing move prefix. Got: '{copied_text[:200]}'"
|
f"Copied message missing move prefix '(Auftrag von @...'. "
|
||||||
|
f"Got: '{copied_text[:200]}'"
|
||||||
)
|
)
|
||||||
assert "rocketchat" in copied_text.lower(), (
|
assert "hermes" in copied_text.lower(), (
|
||||||
f"Copied message does not contain original keyword 'rocketchat'. "
|
f"Copied message does not contain original keyword 'hermes'. "
|
||||||
f"Got: '{copied_text[:200]}'"
|
f"Got: '{copied_text[:200]}'"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Verify message ownership
|
# ── Assertion C: Message ownership ─────────────────────────────────
|
||||||
|
assert_bot_message(
|
||||||
|
move_req_msg,
|
||||||
|
expected_username=bot_username,
|
||||||
|
context="test_03_move_request_source",
|
||||||
|
)
|
||||||
assert_bot_message(
|
assert_bot_message(
|
||||||
copied_msg,
|
copied_msg,
|
||||||
expected_username=bot_username,
|
expected_username=bot_username,
|
||||||
context="test_03_move_request_target",
|
context="test_03_move_request_target",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Cleanup: delete messages from both rooms
|
# ── Assertion D: Cursor-Trennung ────────────────────────────────────
|
||||||
|
# The target message must be strictly after the source cursor,
|
||||||
|
# otherwise it's from a previous test session.
|
||||||
|
copied_ts = copied_msg.get("ts", "")
|
||||||
|
assert copied_ts > target_cursor, (
|
||||||
|
f"Target message timestamp {copied_ts[:19]} is not after "
|
||||||
|
f"target_cursor {target_cursor[:19]} — message may be from "
|
||||||
|
f"a previous test session"
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Cleanup ────────────────────────────────────────────────────────
|
||||||
for mid in posted_ids_source:
|
for mid in posted_ids_source:
|
||||||
try:
|
try:
|
||||||
rc_client.delete_message(source_room, mid)
|
rc_client.delete_message(source_room, mid)
|
||||||
@@ -266,8 +311,8 @@ def test_03_move_request(
|
|||||||
logger.warning("Cleanup source: failed to delete %s: %s", mid[:12], e)
|
logger.warning("Cleanup source: failed to delete %s: %s", mid[:12], e)
|
||||||
for mid in posted_ids_target:
|
for mid in posted_ids_target:
|
||||||
try:
|
try:
|
||||||
rc_client.delete_message(target_room, mid)
|
rc_client.delete_message(rocket_chat_plugin_room, mid)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning("Cleanup target: failed to delete %s: %s", mid[:12], e)
|
logger.warning("Cleanup target: failed to delete %s: %s", mid[:12], e)
|
||||||
|
|
||||||
logger.info("Test 03 PASSED: move-request flow OK")
|
logger.info("Test 03 PASSED: move-request button flow OK")
|
||||||
|
|||||||
@@ -1,60 +1,238 @@
|
|||||||
"""
|
"""
|
||||||
Test 05 — Antwort nach Stream-Abbruch (Stream-Retry).
|
Test 05 — ContextVar-Isolation unter paralleler Last.
|
||||||
|
|
||||||
TODO: Implementierung sobald Stream-Retry auf .45 verfügbar.
|
Verifiziert dass parallele LLM-Streams in verschiedenen Räumen nicht
|
||||||
|
kontaminieren (F6 R24: _CURRENT_TASK_TOKEN + _set_room_context_origin).
|
||||||
|
|
||||||
Szenario:
|
Szenario:
|
||||||
1. Sende eine Nachricht, die einen langen Stream triggert
|
1. Sende eine Nachricht in test_room, die eine lange Antwort triggert
|
||||||
2. Simuliere Stream-Abbruch (DDP disconnect/reconnect)
|
(>10s LLM-Stream, z.B. "Erkläre ausführlich die Architektur...")
|
||||||
3. Verifiziere: Bot sendet Retry und liefert vollständige Antwort
|
2. Sofort eine zweite Nachricht in test-rc-target mit 100%-Keyword
|
||||||
|
("rocketchat ddp bug") — kurze Antwort erwartet
|
||||||
|
3. Warte auf Bot-Antworten in beiden Räumen (sequenziell)
|
||||||
|
4. Verifiziere: Antwort in test_room enthält Architektur-Keywords,
|
||||||
|
Antwort in test-rc-target ist Auto-Route oder Move-Request
|
||||||
|
5. Cross-Contamination-Check: test_room hat keine "rüber"/"Move"-Nachricht,
|
||||||
|
test-rc-target hat keine "Architektur"-Nachricht
|
||||||
|
|
||||||
Benötigt:
|
Dies ist KEIN klassischer Stream-Retry-Test (Stream-Abbruch ist nicht
|
||||||
- Stream-Abbruch-Simulation (DDP disconnect auf .45)
|
simulierbar via REST), sondern ein ContextVar-Isolation-Test unter Last.
|
||||||
- Retry-Logik im Adapter (stream_retry Mechanismus)
|
F6 R24 hat dies mit 20/20 Unit-Tests abgesichert — dieser Test ist
|
||||||
- Timeout-Handling für abgebrochene Streams
|
defense-in-depth im Live-Kontext.
|
||||||
|
|
||||||
Aktueller Status: Stream-Retry ist in adapter.py noch nicht vollständig
|
ENV-Vars:
|
||||||
implementiert. Dieser Test wird aktiviert, sobald die Retry-Logik auf
|
- RC_LIVE_TARGET_ROOM (test-rc-target)
|
||||||
.45 deployed und getestet ist.
|
- RC_LIVE_TEST_ROOM (rc-test-automated)
|
||||||
|
|
||||||
|
RATE-LIMIT: 30/min-Bucket, 20s Cooldown zwischen Tests.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from tests.live_rc.conftest import (
|
||||||
|
assert_bot_message,
|
||||||
|
post_test_message,
|
||||||
|
)
|
||||||
|
from tests.live_rc.helpers.polling import (
|
||||||
|
wait_for_bot_message,
|
||||||
|
get_latest_timestamp,
|
||||||
|
PollTimeout,
|
||||||
|
RateLimitSkip,
|
||||||
|
)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def _get_env_room(name: str) -> str:
|
||||||
|
"""Get a room ID from env var, skip test if not set."""
|
||||||
|
val = (os.getenv(name) or "").strip()
|
||||||
|
if not val:
|
||||||
|
pytest.skip(f"{name} not set — skipping isolation test")
|
||||||
|
return val
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.live_rc
|
@pytest.mark.live_rc
|
||||||
@pytest.mark.skip(
|
def test_05_contextvar_isolation_parallel_load(
|
||||||
reason="TODO: Stream-Retry noch nicht auf .45 verfügbar. "
|
|
||||||
"Implementierung folgt nach Deployment der Retry-Logik."
|
|
||||||
)
|
|
||||||
def test_05_stream_retry(
|
|
||||||
rc_client,
|
rc_client,
|
||||||
test_room_id: str,
|
test_room_id: str,
|
||||||
bot_username: str,
|
bot_username: str,
|
||||||
bot_user_id: str,
|
bot_user_id: str,
|
||||||
cursor: str,
|
|
||||||
posted_message_ids: list,
|
|
||||||
rate_limiter,
|
rate_limiter,
|
||||||
cleanup_messages,
|
cleanup_messages,
|
||||||
bot_status_check,
|
bot_status_check,
|
||||||
):
|
):
|
||||||
"""Stream-Retry: Bot antwortet korrekt nach Stream-Abbruch.
|
"""ContextVar-Isolation: Parallele Streams in verschiedenen Räumen.
|
||||||
|
|
||||||
TODO — Implementierungsschritte:
|
Verifiziert dass zwei gleichzeitige LLM-Streams (lange + kurze Antwort)
|
||||||
1. Poste Nachricht, die langen Stream auslöst (z.B. 'Erkläre
|
nicht kontaminieren — die Antworten landen im jeweils korrekten Raum.
|
||||||
die Architektur des Rocket.Chat Plugins im Detail')
|
|
||||||
2. Warte auf Stream-Beginn (erste Chunks via DDP)
|
Steps:
|
||||||
3. Simuliere DDP-Disconnect (kill DDP connection auf .45)
|
1. Cursor für test_room und test-rc-target holen
|
||||||
4. Warte auf Reconnect + Retry
|
2. Lange-Antwort-Trigger in test_room posten
|
||||||
5. Verifiziere: vollständige Antwort nach Retry
|
3. Sofort kurze Keyword-Nachricht in test-rc-target posten
|
||||||
6. Verifiziere: keine doppelten/verlorenen Chunks
|
4. Auf Bot-Antworten in beiden Räumen warten
|
||||||
|
5. Cross-Contamination-Check
|
||||||
"""
|
"""
|
||||||
pytest.skip(
|
target_room = _get_env_room("RC_LIVE_TARGET_ROOM")
|
||||||
"TODO: Stream-Retry noch nicht auf .45 verfügbar. "
|
|
||||||
"Implementierung folgt nach Deployment der Retry-Logik."
|
posted_ids_test: list = []
|
||||||
|
posted_ids_target: list = []
|
||||||
|
|
||||||
|
# ── Step 1: Cursor für beide Räume holen ───────────────────────────
|
||||||
|
cursor_test = get_latest_timestamp(
|
||||||
|
rc_client, test_room_id, rate_limiter=rate_limiter
|
||||||
)
|
)
|
||||||
|
cursor_target = get_latest_timestamp(
|
||||||
|
rc_client, target_room, rate_limiter=rate_limiter
|
||||||
|
)
|
||||||
|
logger.info(
|
||||||
|
"Test 05: cursors — test_room=%s, target=%s",
|
||||||
|
cursor_test[:19], cursor_target[:19],
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Step 2: Lange-Antwort-Trigger in test_room posten ──────────────
|
||||||
|
long_text = (
|
||||||
|
"Erkläre ausführlich die Architektur des Hermes Rocket.Chat Plugins "
|
||||||
|
"inklusive aller Komponenten, Datenflüsse und Sicherheitsmechanismen."
|
||||||
|
)
|
||||||
|
long_msg_id, long_cursor = post_test_message(
|
||||||
|
rc_client, test_room_id, long_text,
|
||||||
|
posted_ids_test, rate_limiter,
|
||||||
|
)
|
||||||
|
logger.info(
|
||||||
|
"Test 05: posted long trigger in test_room (msg=%s, cursor=%s)",
|
||||||
|
long_msg_id[:12], long_cursor[:19],
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Step 3: Sofort kurze Keyword-Nachricht in test-rc-target ───────
|
||||||
|
# "rocketchat ddp bug" — 100% keyword match für #Rocketchat-Plugin
|
||||||
|
short_text = "rocketchat ddp bug"
|
||||||
|
short_msg_id, short_cursor = post_test_message(
|
||||||
|
rc_client, target_room, short_text,
|
||||||
|
posted_ids_target, rate_limiter,
|
||||||
|
)
|
||||||
|
logger.info(
|
||||||
|
"Test 05: posted short trigger in target_room (msg=%s, cursor=%s)",
|
||||||
|
short_msg_id[:12], short_cursor[:19],
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Step 4: Auf Bot-Antworten warten (sequenziell) ─────────────────
|
||||||
|
# Zuerst die kurze Antwort (sollte schneller kommen), dann die lange.
|
||||||
|
# Reihenfolge ist nicht-deterministisch — das ist OK.
|
||||||
|
|
||||||
|
# 4a: Kurze Antwort in test-rc-target
|
||||||
|
try:
|
||||||
|
short_answer = wait_for_bot_message(
|
||||||
|
client=rc_client,
|
||||||
|
room_id=target_room,
|
||||||
|
bot_username=bot_username,
|
||||||
|
cursor=short_cursor,
|
||||||
|
timeout=60.0,
|
||||||
|
rate_limiter=rate_limiter,
|
||||||
|
initial_interval=5.0,
|
||||||
|
)
|
||||||
|
except RateLimitSkip as e:
|
||||||
|
pytest.skip(f"Rate limit triggered: {e}")
|
||||||
|
except PollTimeout as e:
|
||||||
|
pytest.fail(
|
||||||
|
f"Bot did not respond in target_room within 60s. Error: {e}"
|
||||||
|
)
|
||||||
|
|
||||||
|
short_text_answer = short_answer.get("msg", "")
|
||||||
|
short_ts = short_answer.get("ts", "")
|
||||||
|
logger.info(
|
||||||
|
"Test 05: short answer in target_room (ts=%s): '%s'",
|
||||||
|
short_ts[:19], short_text_answer[:200],
|
||||||
|
)
|
||||||
|
posted_ids_target.append(short_answer.get("_id", ""))
|
||||||
|
|
||||||
|
# 4b: Lange Antwort in test_room (timeout 90s für langen Stream)
|
||||||
|
try:
|
||||||
|
long_answer = wait_for_bot_message(
|
||||||
|
client=rc_client,
|
||||||
|
room_id=test_room_id,
|
||||||
|
bot_username=bot_username,
|
||||||
|
cursor=long_cursor,
|
||||||
|
timeout=90.0,
|
||||||
|
rate_limiter=rate_limiter,
|
||||||
|
initial_interval=5.0,
|
||||||
|
)
|
||||||
|
except RateLimitSkip as e:
|
||||||
|
pytest.skip(f"Rate limit triggered: {e}")
|
||||||
|
except PollTimeout as e:
|
||||||
|
pytest.fail(
|
||||||
|
f"Bot did not respond in test_room within 90s. "
|
||||||
|
f"The long answer may have timed out. Error: {e}"
|
||||||
|
)
|
||||||
|
|
||||||
|
long_text_answer = long_answer.get("msg", "")
|
||||||
|
long_ts = long_answer.get("ts", "")
|
||||||
|
logger.info(
|
||||||
|
"Test 05: long answer in test_room (ts=%s, len=%d): '%s'",
|
||||||
|
long_ts[:19], len(long_text_answer), long_text_answer[:200],
|
||||||
|
)
|
||||||
|
posted_ids_test.append(long_answer.get("_id", ""))
|
||||||
|
|
||||||
|
# ── Assertion A: Genau 1 Bot-Antwort in test_room ──────────────────
|
||||||
|
# (wait_for_bot_message returns exactly 1 — verified by the call itself)
|
||||||
|
|
||||||
|
# ── Assertion B: Genau 1 Bot-Antwort in test-rc-target ─────────────
|
||||||
|
# (wait_for_bot_message returns exactly 1 — verified by the call itself)
|
||||||
|
|
||||||
|
# ── Assertion C: test_room-Antwort > 200 Zeichen ───────────────────
|
||||||
|
assert len(long_text_answer) > 200, (
|
||||||
|
f"Long answer too short ({len(long_text_answer)} chars). "
|
||||||
|
f"Expected >200 chars for architecture explanation. "
|
||||||
|
f"Got: '{long_text_answer[:200]}'"
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Assertion D: KEIN Cross-Talk ───────────────────────────────────
|
||||||
|
# test_room darf keine "rüber"/"Move"-Nachricht enthalten
|
||||||
|
cross_talk_indicators = ["rüber", "move", "kopieren", "verschieben"]
|
||||||
|
long_lower = long_text_answer.lower()
|
||||||
|
for ind in cross_talk_indicators:
|
||||||
|
assert ind not in long_lower, (
|
||||||
|
f"Cross-contamination: test_room answer contains '{ind}' — "
|
||||||
|
f"this should only appear in target_room. "
|
||||||
|
f"Answer: '{long_text_answer[:200]}'"
|
||||||
|
)
|
||||||
|
|
||||||
|
# test-rc-target darf keine "Architektur"-Nachricht enthalten
|
||||||
|
short_lower = short_text_answer.lower()
|
||||||
|
assert "architektur" not in short_lower, (
|
||||||
|
f"Cross-contamination: target_room answer contains 'Architektur' — "
|
||||||
|
f"this should only appear in test_room. "
|
||||||
|
f"Answer: '{short_text_answer[:200]}'"
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Assertion E: Message-Ownership ─────────────────────────────────
|
||||||
|
assert_bot_message(
|
||||||
|
long_answer,
|
||||||
|
expected_username=bot_username,
|
||||||
|
context="test_05_isolation_test_room",
|
||||||
|
)
|
||||||
|
assert_bot_message(
|
||||||
|
short_answer,
|
||||||
|
expected_username=bot_username,
|
||||||
|
context="test_05_isolation_target_room",
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Cleanup ────────────────────────────────────────────────────────
|
||||||
|
for mid in posted_ids_test:
|
||||||
|
try:
|
||||||
|
rc_client.delete_message(test_room_id, mid)
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning("Cleanup test_room: failed to delete %s: %s", mid[:12], e)
|
||||||
|
for mid in posted_ids_target:
|
||||||
|
try:
|
||||||
|
rc_client.delete_message(target_room, mid)
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning("Cleanup target: failed to delete %s: %s", mid[:12], e)
|
||||||
|
|
||||||
|
logger.info("Test 05 PASSED: ContextVar-Isolation unter paralleler Last OK")
|
||||||
|
|||||||
@@ -1,65 +1,261 @@
|
|||||||
"""
|
"""
|
||||||
Test 06 — Themenring: gleichzeitige Themen in verschiedenen Räumen.
|
Test 06 — ContextVar-Isolation zwischen parallelen Routings.
|
||||||
|
|
||||||
TODO: Implementierung sobald Themenring auf .45 verfügbar.
|
Verifiziert dass zwei gleichzeitige Nachrichten in verschiedenen Räumen
|
||||||
|
mit unterschiedlichen Keywords unabhängig geroutet werden, ohne dass
|
||||||
|
die Streams sich kontaminieren (F6 R24: _CURRENT_TASK_TOKEN).
|
||||||
|
|
||||||
Szenario:
|
Szenario:
|
||||||
1. Sende Nachrichten mit unterschiedlichen Themen in verschiedene Räume
|
1. /reset in test_room und test-rc-source
|
||||||
2. Verifiziere: Bot routet jedes Thema in den korrekten Zielraum
|
2. Cursor für beide Räume holen
|
||||||
3. Verifiziere: Themenring verhindert Cross-Talk zwischen Räumen
|
3. Beide Nachrichten INNERHALB 1s posten:
|
||||||
4. Verifiziere: Gleichzeitige Streams werden korrekt getrennt
|
- test_room: "lan subnetz maskieren" (keyword "lan" → #LAN-Dokumentation)
|
||||||
|
- test-rc-source: "rocketchat ddp bug" (keyword "rocketchat" → #Rocketchat-Plugin)
|
||||||
|
4. Auf Bot-Antworten in beiden Räumen warten
|
||||||
|
5. Verifiziere: Antwort_A referenziert LAN-Routing,
|
||||||
|
Antwort_B referenziert Rocketchat-Routing
|
||||||
|
6. Cross-Contamination: Antwort_A nicht "rocketchat",
|
||||||
|
Antwort_B nicht "lan"/"subnetz"
|
||||||
|
|
||||||
Benötigt:
|
Dies ist KEIN "Themenring"-Test (der Themenring als Ring-Datenstruktur
|
||||||
- Multi-Room-Setup mit Themenring (topic ring)
|
ist ein anderes Konzept). Der Test verifiziert ContextVar-Isolation
|
||||||
- Mindestens 3 Räume mit unterschiedlichen Themen
|
zwischen parallelen Routings — defense-in-depth für F6 R24.
|
||||||
- Themenring-Logik im Archivar (topic isolation)
|
|
||||||
- Concurrent-Stream-Handling im Adapter
|
|
||||||
|
|
||||||
Aktueller Status: Themenring ist in der Archivar-Roadmap für v0.45
|
ENV-Vars:
|
||||||
vorgesehen, aber noch nicht implementiert. Dieser Test wird aktiviert,
|
- RC_LIVE_SOURCE_ROOM (test-rc-source)
|
||||||
sobald der Themenring auf .45 deployed und getestet ist.
|
- RC_LIVE_TEST_ROOM (rc-test-automated)
|
||||||
|
|
||||||
|
RATE-LIMIT: 30/min-Bucket, 20s Cooldown zwischen Tests.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from tests.live_rc.conftest import (
|
||||||
|
assert_bot_message,
|
||||||
|
post_test_message,
|
||||||
|
)
|
||||||
|
from tests.live_rc.helpers.polling import (
|
||||||
|
wait_for_bot_message,
|
||||||
|
get_latest_timestamp,
|
||||||
|
PollTimeout,
|
||||||
|
RateLimitSkip,
|
||||||
|
)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def _get_env_room(name: str) -> str:
|
||||||
|
"""Get a room ID from env var, skip test if not set."""
|
||||||
|
val = (os.getenv(name) or "").strip()
|
||||||
|
if not val:
|
||||||
|
pytest.skip(f"{name} not set — skipping isolation test")
|
||||||
|
return val
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.live_rc
|
@pytest.mark.live_rc
|
||||||
@pytest.mark.skip(
|
def test_06_concurrent_isolation(
|
||||||
reason="TODO: Themenring noch nicht auf .45 verfügbar. "
|
|
||||||
"Implementierung folgt nach Deployment der Themenring-Logik."
|
|
||||||
)
|
|
||||||
def test_06_concurrent(
|
|
||||||
rc_client,
|
rc_client,
|
||||||
test_room_id: str,
|
test_room_id: str,
|
||||||
bot_username: str,
|
bot_username: str,
|
||||||
bot_user_id: str,
|
bot_user_id: str,
|
||||||
cursor: str,
|
|
||||||
posted_message_ids: list,
|
|
||||||
rate_limiter,
|
rate_limiter,
|
||||||
cleanup_messages,
|
cleanup_messages,
|
||||||
bot_status_check,
|
bot_status_check,
|
||||||
):
|
):
|
||||||
"""Themenring: Gleichzeitige Themen in verschiedenen Räumen.
|
"""ContextVar-Isolation: Parallele Routings in verschiedenen Räumen.
|
||||||
|
|
||||||
TODO — Implementierungsschritte:
|
Verifiziert dass zwei gleichzeitige Nachrichten mit unterschiedlichen
|
||||||
1. Richte 3 Test-Räume mit unterschiedlichen Themen ein
|
Keywords unabhängig geroutet werden — keine Cross-Contamination.
|
||||||
(z.B. #BAT-Team, #Rocketchat-Plugin, #LAN-Dokumentation)
|
|
||||||
2. Sende gleichzeitig (oder kurz nacheinander) thematisch
|
Steps:
|
||||||
unterschiedliche Nachrichten in den Haupt-Testraum
|
1. /reset in beiden Räumen
|
||||||
3. Verifiziere: Jede Nachricht wird in den korrekten
|
2. Cursor holen
|
||||||
Themenraum geroutet
|
3. Beide Nachrichten innerhalb 1s posten
|
||||||
4. Verifiziere: Kein Cross-Talk — BAT-Nachricht landet nicht
|
4. Auf Bot-Antworten warten
|
||||||
im Rocketchat-Raum
|
5. Cross-Contamination-Check
|
||||||
5. Verifiziere: Themenring-Isolation funktioniert auch bei
|
|
||||||
überlappenden Keywords
|
|
||||||
"""
|
"""
|
||||||
pytest.skip(
|
source_room = _get_env_room("RC_LIVE_SOURCE_ROOM")
|
||||||
"TODO: Themenring noch nicht auf .45 verfügbar. "
|
|
||||||
"Implementierung folgt nach Deployment der Themenring-Logik."
|
posted_ids_test: list = []
|
||||||
|
posted_ids_source: list = []
|
||||||
|
|
||||||
|
# ── Step 1: /reset in beiden Räumen ────────────────────────────────
|
||||||
|
# Clear sticky topics from previous tests.
|
||||||
|
_reset_test_id, _ = post_test_message(
|
||||||
|
rc_client, test_room_id, "/reset",
|
||||||
|
posted_ids_test, rate_limiter,
|
||||||
)
|
)
|
||||||
|
_reset_source_id, _ = post_test_message(
|
||||||
|
rc_client, source_room, "/reset",
|
||||||
|
posted_ids_source, rate_limiter,
|
||||||
|
)
|
||||||
|
logger.info(
|
||||||
|
"Test 06: sent /reset to test_room (msg %s) and source_room (msg %s)",
|
||||||
|
_reset_test_id[:12], _reset_source_id[:12],
|
||||||
|
)
|
||||||
|
# Wait for /reset responses
|
||||||
|
time.sleep(5.0)
|
||||||
|
|
||||||
|
# ── Step 2: Cursor für beide Räume holen ───────────────────────────
|
||||||
|
cursor_test = get_latest_timestamp(
|
||||||
|
rc_client, test_room_id, rate_limiter=rate_limiter
|
||||||
|
)
|
||||||
|
cursor_source = get_latest_timestamp(
|
||||||
|
rc_client, source_room, rate_limiter=rate_limiter
|
||||||
|
)
|
||||||
|
logger.info(
|
||||||
|
"Test 06: cursors — test_room=%s, source=%s",
|
||||||
|
cursor_test[:19], cursor_source[:19],
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Step 3: Beide Nachrichten INNERHALB 1s posten ──────────────────
|
||||||
|
# Nachricht A: test_room — "lan subnetz maskieren" (keyword "lan" → #LAN-Dokumentation)
|
||||||
|
text_a = "lan subnetz maskieren"
|
||||||
|
msg_a_id, cursor_a = post_test_message(
|
||||||
|
rc_client, test_room_id, text_a,
|
||||||
|
posted_ids_test, rate_limiter,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Nachricht B: test-rc-source — "rocketchat ddp bug" (keyword "rocketchat" → #Rocketchat-Plugin)
|
||||||
|
text_b = "rocketchat ddp bug"
|
||||||
|
msg_b_id, cursor_b = post_test_message(
|
||||||
|
rc_client, source_room, text_b,
|
||||||
|
posted_ids_source, rate_limiter,
|
||||||
|
)
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
"Test 06: posted A='%s' (msg=%s) in test_room, B='%s' (msg=%s) in source_room",
|
||||||
|
text_a, msg_a_id[:12], text_b, msg_b_id[:12],
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Step 4: Auf Bot-Antworten warten (sequenziell) ─────────────────
|
||||||
|
start_time = time.monotonic()
|
||||||
|
|
||||||
|
# 4a: Antwort in test_room (LAN-Routing)
|
||||||
|
try:
|
||||||
|
answer_a = wait_for_bot_message(
|
||||||
|
client=rc_client,
|
||||||
|
room_id=test_room_id,
|
||||||
|
bot_username=bot_username,
|
||||||
|
cursor=cursor_a,
|
||||||
|
timeout=60.0,
|
||||||
|
rate_limiter=rate_limiter,
|
||||||
|
initial_interval=5.0,
|
||||||
|
)
|
||||||
|
except RateLimitSkip as e:
|
||||||
|
pytest.skip(f"Rate limit triggered: {e}")
|
||||||
|
except PollTimeout as e:
|
||||||
|
pytest.fail(
|
||||||
|
f"Bot did not respond in test_room within 60s. Error: {e}"
|
||||||
|
)
|
||||||
|
|
||||||
|
answer_a_text = answer_a.get("msg", "")
|
||||||
|
answer_a_ts = answer_a.get("ts", "")
|
||||||
|
logger.info(
|
||||||
|
"Test 06: answer A in test_room (ts=%s): '%s'",
|
||||||
|
answer_a_ts[:19], answer_a_text[:200],
|
||||||
|
)
|
||||||
|
posted_ids_test.append(answer_a.get("_id", ""))
|
||||||
|
|
||||||
|
# 4b: Antwort in test-rc-source (Rocketchat-Routing)
|
||||||
|
try:
|
||||||
|
answer_b = wait_for_bot_message(
|
||||||
|
client=rc_client,
|
||||||
|
room_id=source_room,
|
||||||
|
bot_username=bot_username,
|
||||||
|
cursor=cursor_b,
|
||||||
|
timeout=60.0,
|
||||||
|
rate_limiter=rate_limiter,
|
||||||
|
initial_interval=5.0,
|
||||||
|
)
|
||||||
|
except RateLimitSkip as e:
|
||||||
|
pytest.skip(f"Rate limit triggered: {e}")
|
||||||
|
except PollTimeout as e:
|
||||||
|
pytest.fail(
|
||||||
|
f"Bot did not respond in source_room within 60s. Error: {e}"
|
||||||
|
)
|
||||||
|
|
||||||
|
answer_b_text = answer_b.get("msg", "")
|
||||||
|
answer_b_ts = answer_b.get("ts", "")
|
||||||
|
logger.info(
|
||||||
|
"Test 06: answer B in source_room (ts=%s): '%s'",
|
||||||
|
answer_b_ts[:19], answer_b_text[:200],
|
||||||
|
)
|
||||||
|
posted_ids_source.append(answer_b.get("_id", ""))
|
||||||
|
|
||||||
|
elapsed = time.monotonic() - start_time
|
||||||
|
|
||||||
|
# ── Assertion A: Je 1 Bot-Antwort in jedem Raum ────────────────────
|
||||||
|
# (wait_for_bot_message returns exactly 1 — verified by the calls)
|
||||||
|
|
||||||
|
# ── Assertion B: Antwort_A bezieht sich auf LAN-Routing ────────────
|
||||||
|
answer_a_lower = answer_a_text.lower()
|
||||||
|
lan_indicators = ["lan", "dokumentation", "subnetz", "netzwerk", "homelab"]
|
||||||
|
has_lan_reference = any(ind in answer_a_lower for ind in lan_indicators)
|
||||||
|
assert has_lan_reference, (
|
||||||
|
f"Answer A does not reference LAN routing. "
|
||||||
|
f"Expected one of {lan_indicators}. "
|
||||||
|
f"Got: '{answer_a_text[:200]}'"
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Assertion C: Antwort_B bezieht sich auf Rocketchat-Routing ─────
|
||||||
|
answer_b_lower = answer_b_text.lower()
|
||||||
|
rc_indicators = ["rocketchat", "plugin", "ddp", "adapter", "gateway"]
|
||||||
|
has_rc_reference = any(ind in answer_b_lower for ind in rc_indicators)
|
||||||
|
assert has_rc_reference, (
|
||||||
|
f"Answer B does not reference Rocketchat routing. "
|
||||||
|
f"Expected one of {rc_indicators}. "
|
||||||
|
f"Got: '{answer_b_text[:200]}'"
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Assertion D: KEIN Cross-Talk ───────────────────────────────────
|
||||||
|
# Antwort_A (LAN) darf NICHT "rocketchat" enthalten
|
||||||
|
assert "rocketchat" not in answer_a_lower, (
|
||||||
|
f"Cross-contamination: Answer A (LAN) contains 'rocketchat'. "
|
||||||
|
f"Answer: '{answer_a_text[:200]}'"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Antwort_B (Rocketchat) darf NICHT "lan" oder "subnetz" enthalten
|
||||||
|
for forbidden in ["lan", "subnetz"]:
|
||||||
|
assert forbidden not in answer_b_lower, (
|
||||||
|
f"Cross-contamination: Answer B (Rocketchat) contains '{forbidden}'. "
|
||||||
|
f"Answer: '{answer_b_text[:200]}'"
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Assertion E: Beide von bot_username ────────────────────────────
|
||||||
|
assert_bot_message(
|
||||||
|
answer_a,
|
||||||
|
expected_username=bot_username,
|
||||||
|
context="test_06_isolation_test_room",
|
||||||
|
)
|
||||||
|
assert_bot_message(
|
||||||
|
answer_b,
|
||||||
|
expected_username=bot_username,
|
||||||
|
context="test_06_isolation_source_room",
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Assertion F: Beide innerhalb 60s ───────────────────────────────
|
||||||
|
assert elapsed < 60.0, (
|
||||||
|
f"Both answers took {elapsed:.1f}s — expected <60s. "
|
||||||
|
f"Concurrency may be broken (deadlock?)."
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Cleanup ────────────────────────────────────────────────────────
|
||||||
|
for mid in posted_ids_test:
|
||||||
|
try:
|
||||||
|
rc_client.delete_message(test_room_id, mid)
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning("Cleanup test_room: failed to delete %s: %s", mid[:12], e)
|
||||||
|
for mid in posted_ids_source:
|
||||||
|
try:
|
||||||
|
rc_client.delete_message(source_room, mid)
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning("Cleanup source: failed to delete %s: %s", mid[:12], e)
|
||||||
|
|
||||||
|
logger.info("Test 06 PASSED: ContextVar-Isolation zwischen parallelen Routings OK")
|
||||||
|
|||||||
Reference in New Issue
Block a user