connector-telegram: use teloxide-core instead of a hand-rolled client (decision needed) - #65
Open
radicalkjax wants to merge 1 commit into
Open
connector-telegram: use teloxide-core instead of a hand-rolled client (decision needed)#65radicalkjax wants to merge 1 commit into
radicalkjax wants to merge 1 commit into
Conversation
… (plan 5.1)
Replace the hand-rolled reqwest client behind `TelegramApi` with
`teloxide_core::Bot`. The trait keeps its string-and-JSON signatures so
the ten action/polling call sites and every mock-client test are
untouched; the SDK's typed models are re-encoded to JSON at the boundary.
- teloxide-core 0.13 added as a workspace dep with `default-features =
false, features = ["rustls"]`; `native-tls`, `openssl-sys`, `hyper-tls`
absent from the connector graph. `url` added (SDK takes `url::Url`).
- Deleted: manual URL building (token in path), `{ok,result}` /
`retry_after` parsing, hand-built JSON bodies, `TelegramError::Reqwest`.
`RequestError::RetryAfter` maps to `RateLimited` so polling back-off is
unchanged; teloxide strips the token from network errors before Display.
- Long polling uses the SDK's `getUpdates` with the same offset/timeout/
allowed_updates semantics. Webhook secret-token check, manifest,
trigger/action names and output schemas are unchanged; the JSON-based
update normaliser is kept (as #51 did for GitHub).
- `takecell` pinned to 0.1.1 (0.1.2 needs rustc 1.96; toolchain is 1.94).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018M415coMKAv5V2xJQsaSf8
Member
Author
|
Upstream check: teloxide's main branch already depends on reqwest 0.13.3 (crates/teloxide-core/Cargo.toml), so the next teloxide-core release unifies the rustls stack and restores the post-quantum key exchange for Telegram traffic. Holding this PR until that release rather than merging a classical-KEX regression or pinning a git revision. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Replaces the connector's hand-rolled Telegram Bot API client with
teloxide-core0.13 (rustls only), keeping the connector's API trait so the ten action modules and their mock tests are untouched; typed results are re-encoded to the trait's JSON shapes. Manual URL and token-path building,{ok,result}/retry_afterparsing, and hand-built bodies are gone. Long polling keeps its offset/timeout/allowed_updates semantics on the SDK'sgetUpdates. Manifest, trigger and action names, output schemas, and theX-Telegram-Bot-Api-Secret-Tokencheck are unchanged. The JSON update normaliser is kept: the SDK'sUpdateis strict on kinds and would drop update types the pass-through tolerates. One incidental fix: the old error display could include the request URL, which carries the bot token; the SDK strips it.Decision needed before merging
safe_http's redirect cap also does not apply; timeouts were mirrored onto the SDK's settings.Arc<str>with no zeroization.cargo denywarnsmultiple-versions(policy is warn, not deny).takecellis pinned to 0.1.1 because 0.1.2 needs rustc 1.96 and the local toolchain is 1.94.1.The GitHub migration (#51) had the smaller version of this trade-off (no redirect cap, but the same rustls stack and PQ provider). Here the loss is larger. Options: merge and accept classical key exchange for Telegram until teloxide catches up; or hold the branch until a teloxide-core release on reqwest 0.13 exists.
Verification
cargo clippy -p connector-telegram --all-targets -- -D warnings;cargo test -p connector-telegram: 68 passedcargo tree -i native-tls,-i openssl-sys,-i hyper-tls: none;cargo deny check licenses bans: okFinding 88 (Telegram) in
docs/ALIGNMENT-PLAN.md.🤖 Generated with Claude Code
https://claude.ai/code/session_018M415coMKAv5V2xJQsaSf8