Fixed-index truncation could split an HTML tag or entity or drop a closing tag, making Telegram reject the whole message with 'can't parse entities'. Cut on a newline boundary where tags are balanced, reserve room for a truncation notice, and strip any trailing partial markup.
Swap the Redis datastore for MongoDB via mongo-driver v2. New
internal/mongostore mirrors the old redisstore type/constant names so
consumers change only the import qualifier; document model collapses the
multi-key subscriber/settings and per-event delivery sets into single-doc
operations and a TTL-indexed delivery collection.
Config now requires MONGODB_URI (Atlas) with MONGODB_DATABASE selecting
dev vs prod on one cluster; REDIS_URL removed. Compose files run bot-only
against Atlas. Default tests stay Docker-free (poller/bot use fakes,
mongostore unit tests are pure-logic); a gated //go:build integration
suite covers the real backend via testcontainers.
Replace the per-subscriber SISMEMBER delivery check with a single
SMEMBERS per event plus in-memory lookups, cutting N round-trips to one.
Remove the component-label helpers duplicated between poller and bot by
exporting the canonical versions from poller; bot already depends on it.
Collapse the repeated component checkpoint closures into a shared helper.
Drop the redundant escapeAttr alias and the unused variadic on bot.New.