The project now has four clear runtime/deployment areas:
infra: shared internal TLS bootstrapbot: Telegram-facing application plus PostgreSQL, RustFS, and database backup resourcesdownloader: media worker nodes plus sharedyt-pot-providercookie_assignment: independent cookie distribution controller
The bot no longer owns cookie assignment.
- Split cookie assignment out of the bot into its own crate, config, chart, and image flow.
- Moved shared cert-manager CA bootstrap resources into
charts/infra. - Switched cookie inventory to
cookies/<domain>/<cookie-id>.txtand simplified runtime mounting by decoding flattened entry names in Rust instead of rebuilding files in an init container. - Improved cookie reconciliation:
- removed source cookies are actively revoked from nodes
- free cookies are placed by least-loaded eligible worker instead of first-fit
- empty DNS/status/list cycles keep previous assignments instead of clearing state
ListNodeCookiesfailures keep existing assignments for the affected worker and skip it for new assignments in that cycle
- Extracted shared downloader access into
downloader_client:- node discovery
- mTLS/auth setup
- node selection
- failover/retry
- downloader RPC wrappers and stream decoding
- cookie-assignment cookie-manager RPC wrappers
- Split downloader-node auth into normal node tokens and cookie-manager token so bots cannot call cookie mutation RPCs, and cookie assignment no longer needs any normal node token.
- Downloader now accepts a list of bot/node tokens through
[auth].node_tokens, which allows separate tokens per bot. - Allowed
NodeCapabilitiesto accept either token so cookie assignment can check node status with the cookie-manager token only. - Documented the intended path for adding another bot: new crate, own chart/config/TLS cert, direct
downloader_clientusage, optional messenger-specific cache, and no cookie-manager token. - Bot startup now runs an initial downloader-node status/capability refresh before accepting updates; refresh errors are logged and ignored by the router.
- Introduced
MessengerPortwithTelegramMessengeras the outbound Telegram adapter. - Moved bot-side Telegram send/edit/upload/media-group logic behind the messenger adapter.
- Reworked DI to use the current generic
Messengerpattern instead of binding bot code directly to the concrete Telegram adapter. - Split bot internals conceptually into:
interactorsfor handler-facing orchestration- lower-level
servicesfor reusable internal services and integration adapters
- Moved handler orchestration into flat top-level interactors:
startstatsconfiginline_queryvideoaudiochosen_inline
- Reduced handlers to thin Telegram adapters that:
- extract Telegram input
- inject one top-level interactor
- call it
- Switched PostgreSQL backups to the current CloudNativePG Barman Cloud Plugin model:
ObjectStoreowns S3/RustFS backup destination configurationCluster.spec.pluginsenables WAL archiving throughbarman-cloud.cloudnative-pg.ioScheduledBackupusesmethod: plugin- RustFS stays single-node and bootstraps the
backupsbucket with a Helm hook Job
cargo check -p bot -p cookie_assignment -p downloaderpassed.cargo check -p downloader_client -p botpassed.cargo check -p botpassed after the latest handler-to-interactor refactor.cargo check -p downloader_client -p downloader -p cookie_assignment -p botpassed after downloader auth split and cookie-assignment client reuse.cargo check -p bot -p cookie_assignment -p downloader -p downloader_client -p protopassed after shortening local crate package names.cargo fmtcould not be run here becauserustfmtis not available in the current toolchain environment.
- Downloader cookie storage is still one file per domain in
/tmp/cookies/<domain>.txt. That is acceptable with the current rule “at most one cookie per domain per node”, but it is still a structural limitation. - The outbound Telegram boundary is now centralized, but interactor input DTOs still carry Telegram-shaped identifiers like
chat_id,message_id, andinline_message_id. - Inbound transport extraction is still handler-side. Handlers are thin now, but Telegram update mapping has not been moved into a stronger inbound adapter layer.