You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nothing fails when aiogram reaches the API's cold start #272
The API's cold start is kept free of aiogram on purpose, and nothing checks it. app/main.py mounts the webhook only when it is configured, app/api/telegram.py imports app.bot.bot inside _instances(), and _build_bot is imported lazily in app/api/edit.py, app/api/cron.py and app/api/manage/requests.py — CLAUDE.md says why: aiogram on that path is a slower start for every request that never touches the bot. tests/test_service_layering.py keeps app.bot out of services/, but it reads source for that one rule; no test imports app.main and asks whether aiogram came with it.
Failure scenario. A refactor adds from app.bot.render import more_line at the top of an API module, or a package __init__ re-exports a bot helper next to an API one. Every test passes; production's cold start now imports aiogram and its dependencies on every fresh Vercel instance, and the first sign is latency nobody can attribute.
The risk grows with the work planned next: the server decomposition and the new rpc/ and rest/ packages of docs/specs/2026-10-03-one-contract-design.md add exactly the kind of new modules and re-exporting __init__ files that carry an import in by accident.
Fix. A test that imports app.main in a fresh interpreter (a subprocess, so earlier tests' imports do not count) and fails if aiogram is in sys.modules; the layering rule extended to the new packages when they exist.
Activity
Say that the board is level again, and how #294's item was brought back