test(telegram): cover env-clamped helper + adaptive text-batch tiers

- New tests/gateway/test_telegram_text_batch_perf.py:
  TestEnvFloatClamped — 7 tests covering default-when-unset, valid
  parse, garbage fallback, NaN rejection, Inf rejection, min-clamp,
  max-clamp.  Asserts asyncio.sleep() always gets a finite number.

  TestAdaptiveTextBatchTiers — 4 tests covering the tier-constant
  invariants and the min(cap, tier_delay) composition rule.

- tests/gateway/test_display_config.py: update assertions for
  Telegram's new tool_progress='new' default.
This commit is contained in:
teknium1 2026-05-10 22:18:14 -07:00 committed by Teknium
parent ac95b8cdbe
commit edb4a2bda5
2 changed files with 142 additions and 5 deletions

View file

@ -41,8 +41,9 @@ class TestResolveDisplaySetting:
# Empty config — should get built-in defaults
config = {}
# Telegram defaults to tier_high → "all"
assert resolve_display_setting(config, "telegram", "tool_progress") == "all"
# Telegram tier_high override: "new" (not "all") to reduce edit
# pressure during streaming on Telegram's ~1 edit/s flood envelope.
assert resolve_display_setting(config, "telegram", "tool_progress") == "new"
# Email defaults to tier_minimal → "off"
assert resolve_display_setting(config, "email", "tool_progress") == "off"
@ -179,11 +180,14 @@ class TestPlatformDefaults:
"""Built-in defaults reflect platform capability tiers."""
def test_high_tier_platforms(self):
"""Telegram and Discord default to 'all' tool progress."""
"""Discord defaults to 'all' tool progress; Telegram is in tier_high
but overrides tool_progress to 'new' (less edit pressure)."""
from gateway.display_config import resolve_display_setting
for plat in ("telegram", "discord"):
assert resolve_display_setting({}, plat, "tool_progress") == "all", plat
# Telegram: tier_high member with tool_progress="new" override.
assert resolve_display_setting({}, "telegram", "tool_progress") == "new"
# Discord: pure tier_high.
assert resolve_display_setting({}, "discord", "tool_progress") == "all"
def test_medium_tier_platforms(self):
"""Mattermost, Matrix, Feishu, WhatsApp default to 'new' tool progress."""