Telegram: Plain-Text-Fallback bei Parse-Fehler, tag-sichere Kürzung auf 4096. Matrix: bytebewusste Kürzung. Downtime: lesender Abgleich nach dem POST, generische Fehlermeldung im Chat. Agent: Platzhalter für nicht ausgeführte Tool-Calls, Text im letzten Schritt erzwingen, Zeitreserve, Kompaktierung, Limit pro Antwort. CLAUDE.md: Fallbacks für Phase 6d. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
18 lines
454 B
Python
18 lines
454 B
Python
from app.agent.sanitize import TRUNCATION_SUFFIX, sanitize
|
|
|
|
|
|
def test_sanitize_short_text_untouched():
|
|
assert sanitize("hallo", 20) == "hallo"
|
|
|
|
|
|
def test_sanitize_truncates_with_suffix_and_respects_limit():
|
|
text = "A" * 50
|
|
result = sanitize(text, 20)
|
|
assert len(result) <= 20
|
|
assert result.endswith(TRUNCATION_SUFFIX)
|
|
|
|
|
|
def test_sanitize_tiny_limit_still_within_bound():
|
|
result = sanitize("A" * 50, 3)
|
|
assert len(result) <= 3
|