Files
ironclaw/channels-src
firat.sertgoz f9ed81522f test: add Telegram E2E tests and Rust integration tests (#2037)
* Add Telegram local regression test harness

* Add local Telegram smoke test runner

* test: add high-priority Telegram regression tests

Cover 6 previously untested API-level flows using fake axum Telegram
servers: photo attachment download, voice attachment download, long
message splitting (>4096 chars), Markdown parse error fallback to
plain text, sendChatAction typing indicator, and polling mode
(getUpdates with offset tracking).

Test count: 13 → 19. All use real WASM channel execution with
env-var URL override.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test: add full-process Telegram E2E tests

Add 4 end-to-end tests that boot IronClaw, activate the Telegram WASM
channel via the setup API, POST webhook updates, and verify the
sendMessage round-trip through the mock LLM to a fake Telegram API.

Tests cover:
- DM round-trip (setup → webhook → LLM → sendMessage)
- Edited message handling
- Unauthorized user rejection (dm_policy = pairing)
- Invalid webhook secret rejection (401)

New files:
- fake_telegram_api.py: aiohttp server faking the Telegram Bot API
- test_telegram_e2e.py: the 4 test scenarios

conftest.py changes:
- Add fake_telegram_server and telegram_e2e_server fixtures
- Extend _wasm_build_symlinks to also cover channels-src/

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test: expand Telegram E2E coverage with 8 new regression tests

Add 8 new tests covering core functionality gaps and high-priority
error resilience scenarios for the Telegram WASM channel:

Round 1 (functionality):
- Group mention filtering (ignore without @bot, reply with @bot)
- Long message chunking (>4096 chars split correctly)
- Polling mode roundtrip (getUpdates picks up queued messages)
- Markdown fallback (400 parse error triggers plain-text retry)

Round 2 (resilience):
- Missing webhook secret header (401 rejection)
- 429 rate limit resilience (system survives, recovers)
- Document download failure (getFile 500, text still processed)
- Malformed payload resilience (invalid JSON handled, bot continues)

Also extends fake_telegram_api.py with reject_markdown, rate_limit,
and fail_downloads simulation flags plus control endpoints, and adds
a "long response" canned pattern to mock_llm.py.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: resolve CI failures in Telegram test suite

- Add #[cfg(feature = "integration")] gate to
  test_bot_mention_detection_case_insensitive and
  build_telegram_update_value (fixes compilation on default/libsql)
- Run cargo fmt on telegram_auth_integration.rs
- Fix race condition in fake_telegram_api.py get_updates
- Increase rate_limit_count from 5 to 20 for retry resilience
- Move helper functions to proper section in test_telegram_e2e.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 16:21:01 +09:00
..