live_rc: Rate-Limiter-Kalibrierung + Test 03/04 implementiert + ENV-Skip-Fix + README

AUFGABE 1 — Rate-Limiter-Kalibrierung:
- Polling-Intervalle: 2s → 3s → 5s → 8s (statt 100ms→200ms→500ms)
- 429-Backoff: 3s → 6s → 12s → 24s (exponentiell)
- Max 30 Calls/Minute (statt 60) — RC triggert 429 bei 3-4 Calls in <10s
- 3 consecutive 429s → RateLimitSkip (Test wird geskippt, nicht failed)
- Cursor-Caching: channels.history nur beim ersten Poll, dann Cache-Scan

AUFGABE 2 — ENV-Skip-Logik:
- pytest_collection_modifyitems in conftest.py: alle live_rc-Tests werden
  bereits bei Collection geskippt wenn RC_LIVE_URL nicht gesetzt ist
- Kein Fixture-Overhead, keine Imports — sauberer Early-Skip

AUFGABE 3 — TEST 03: Move-Request (vollständig):
- Keyword 'rocketchat' in test-rc-source triggert Archivar
- Bot sendet Move-Request-Buttons (verifiziert)
- Button-Klick via MOVE_REQ:<rid>::confirm_move Payload
- Bot kopiert Nachricht nach test-rc-target mit Präfix
- Verifikation: kopierte Nachricht enthält Original-Text + Präfix
- ENV: RC_LIVE_SOURCE_ROOM, RC_LIVE_TARGET_ROOM

AUFGABE 4 — TEST 04: Multi-Room (DM-Proxy → Archivar → Projektraum):
- Haupt-Testraum als DM-Proxy
- Keyword_100-Match 'rocketchat' → FAISS-Auto-Route in Projektraum
- Verifikation: kopierte Nachricht im Projektraum (wenn FAISS >= 0.85)
- Graceful: kein Fail wenn Auto-Route nicht triggert (Butler-Mode)
- ENV: RC_LIVE_PROJECT_ROOM

AUFGABE 5 — TEST 05+06: Skeletons mit TODO-Markern:
- test_05_stream_retry: skip mit Begründung (Stream-Retry auf .45 pending)
- test_06_concurrent: skip mit Begründung (Themenring auf .45 pending)
- Beide mit vollständigen Implementierungsschritten als TODO-Kommentare

AUFGABE 6 — README.md:
- Alle ENV-Variablen dokumentiert (Pflicht + Optional)
- Ausführ-Anleitung mit Beispielen
- Test-Übersichtstabelle mit Status
- Rate-Limiting-Dokumentation
- Architektur-Übersicht
This commit is contained in:
Bernd (Hermes)
2026-07-28 16:58:50 +02:00
parent 6a09caa1e5
commit 16c1ad927e
9 changed files with 708 additions and 57 deletions
+11 -5
View File
@@ -21,7 +21,7 @@ HINTERGRUND (aus adapter.py _process_incoming, Zeile 1987-1999):
TEST-SZENARIO:
1. Poste "ONBOARD:<test_room_id>::select_<test_room_id>" via REST
2. Warte auf Bot-Antwort (max 10s)
2. Warte auf Bot-Antwort (max 18s)
3. Verifiziere: Bot hat geantwortet (Nachricht wurde empfangen + verarbeitet)
4. Verifiziere: Antwort stammt von mytestbot
@@ -40,7 +40,11 @@ from tests.live_rc.conftest import (
assert_bot_message,
post_test_message,
)
from tests.live_rc.helpers.polling import wait_for_bot_message
from tests.live_rc.helpers.polling import (
wait_for_bot_message,
PollTimeout,
RateLimitSkip,
)
logger = logging.getLogger(__name__)
@@ -87,12 +91,14 @@ def test_02_button_click_simulation(
room_id=test_room_id,
bot_username=bot_username,
cursor=cursor,
timeout=12.0,
timeout=18.0,
rate_limiter=rate_limiter,
)
except Exception as e:
except RateLimitSkip as e:
pytest.skip(f"Rate limit triggered: {e}")
except PollTimeout as e:
pytest.fail(
f"Bot did not respond to ::-text within 12s. "
f"Bot did not respond to ::-text within 18s. "
f"The ::-dispatch may be broken — check adapter.py "
f"_process_incoming is_button_response detection. "
f"Error: {e}"