Helios

Helios — Launch Readiness Report

Generated at phase 67, commit horizon ~67 phases since sprint 0.

Generated at phase 67, commit horizon ~67 phases since sprint 0. Sources: git log, pytest, ruff, mypy, mkdocs build --strict, Mini App pnpm tsc + build. Status: production-ready v1.

Verification matrix

CheckResult
pytest tests/784 / 784 passing
pytest tests/ --randomly-seed=* (6 seeds)passing on every seed
ruff check .clean
ruff format --check .clean (409 files formatted)
mypy --strict apps core infrastructure plugins sharedclean (275 files)
mkdocs build --strictclean
pnpm tsc --noEmit (Mini App)clean
pnpm build (Mini App)79.55 kB gzipped initial route (budget 200 kB)
Alembic head0009_persona_warmup
Stealth whitelist scanclean (no unwhitelisted RPCs)

Shipped surface

Foundation (100%)

  • Parameters registry: 93 keys, full scope hierarchy (GLOBAL → TIER → CLIENT → TEAM → TARGET → CHAT → ROUTE → USERBOT → PERSONA), append-only overrides, validators, pub/sub bus, audit-log integration, hot-reload, audit row per write.
  • Stealth model: runtime guard + CI whitelist scan + 100% line coverage on apps/userbot/stealth/. Forbidden RPCs raise StealthViolation, propagate, page owner.
  • Multi-tenant RLS: helios_app non-superuser role, FORCE RLS, every client-scoped table has its policy, NULL-handling fix in migration 0003.
  • Audit log: hash-chained per day, severity-tagged, daily hash.
  • AES-256-GCM at rest with HKDF per-file keys, KMS-abstracted master key.
  • TOTP (RFC 6238) for owner second factor.
  • Signed callbacks (HMAC-SHA256 truncated to 8 bytes, fits Telegram's 64-byte ceiling), nonce-replay protection, parameter-tuned TTL.
  • Telegram Mini App initData HMAC-SHA256 verification with max-age cap.
  • Resilience dispatcher: every Pyrogram exception mapped to FailureKind, health-score updates, quarantine, owner-DM alerts.

Tier A — every README/CLAUDE.md claim is implemented

  • Chat tracking end-to-end: schema (migration 0008), repositories, REST API, Mini App pages, ingester routing, Pyrogram capture handler + chat-subscription snapshot.
  • Userbot pool runtime: boot loop, stealth-wrap factory, presence + identity pollers, resilience dispatcher.
  • Persona warmup: state machine (new → bio_set → photo_set → contacts_imported → lurking → done), worker, picker integration (picker refuses non-done candidates).
  • Identity / username / photo capture: pure diff, adapter for three Pyrogram-fork variants, ingester routing, Mini App IdentityHistoryCard.
  • Analytics: heatmap, daily rollup, predictions (next-online), sleep schedule, hybrid tier-routing resolver (SUMMARY / HEATMAP / DAILY / PREDICT wired through), Redis-backed cache with ?refresh=true semantics.
  • WebSocket /v1/stream: live per-client event push for Premium+, consumed by Mini App useEventStream hook.
  • Billing: Telegram Stars (XTR), tier grant pipeline, Stealth Mode purchase (1m / 3m / 1y / lifetime).
  • GDPR: ops export + erase endpoints, automated gdpr_purger worker that respects grace + retention windows.
  • Meilisearch indexer: consumer group on helios:events, per- tenant docs with client_ids array, in-memory backend for test+fallback.

Tier B — plugin breadth

Delivery channels (9 of 9 from CLAUDE.md §14.3):

  • bot_message (direct path via notifier worker)
  • webhook (HMAC-SHA256 signed POST)
  • tg_channel (platform bot posts to client-owned channel)
  • tg_topic (forum-topic destinations)
  • external_bot (route-supplied bot token)
  • discord (embed-shaped webhook with severity colours)
  • slack (mrkdwn block-shaped webhook with severity emoji)
  • email (SMTP with STARTTLS via stdlib + asyncio.to_thread)
  • file_archive (JSONL append per route per day)

Payment plugins (5 of 5 from CLAUDE.md §14.1):

  • telegram_stars (XTR via Bot API)
  • cryptobot (pay.crypt.bot REST + HMAC-SHA256 webhooks)
  • cryptapi (api.cryptapi.io REST + per-route nonce webhooks)
  • xrocket (pay.xrocket.tg REST + HMAC-SHA256 webhooks)
  • ton_connect (on-chain TON with operator listener + bearer secret)

Session importers (4 of 6 from CLAUDE.md §14.4):

  • pyrogram_session (SQLite file)
  • pyrogram_string (base64 packed)
  • telethon_session (SQLite file with schema-disambiguating sniff)
  • telethon_string (version-prefixed base64)
  • Missing: tdata (Telegram Desktop archive), tdlib (td.binlog) — both extremely complex multi-file binary formats; documented as future work.

Userbot capture pollers:

  • presence — pyrotgfork getUsers for status (online / offline / recently / last_week / ...) — live.
  • identity — first_name / last_name / bio / username / photo — live with compute_identity_changes diff.
  • chat-message capture: receives Message updates via MessageHandler, filters by tracked-chat snapshot, emits chat.message_captured.
  • Photo / username / story pollers: events are emitted by the identity poller's diff (photo + username); story polling deferred (Telegram's story API surface is more invasive than the read-only guarantee allows for free-tier targets).

Tier C — observability, ops, scale

  • Prometheus metrics: API request count + duration + in-flight, events consumed per worker, payments, status events, health alerts, notifications. Workers expose /metrics on ports 9091-9099.
  • Grafana overview dashboard: 8 panels (pool, queue, latency, events, alerts).
  • Prometheus alert rules: 5 groups (stealth, pool, queue, payments, errors).
  • structlog → Loki: JSON in prod, ConsoleRenderer in dev (fixed in phase 58: format_exc_info only in JSON branch).
  • mkdocs-material: 16-page docs site, strict-mode in CI.
  • WAL-G backup drill runbook (docs/operations/backup-drill.md)
    • drill-history append-only log.
  • First-deploy onboarding (docs/operations/onboarding.md): env vars, DB role grants, alembic upgrade, smoke checks, production hardening checklist.

CI / quality gates

  • Per-package coverage floors enforced (CLAUDE.md §19): core/ ≥ 85%, apps/ ≥ 70%, apps/userbot/stealth/ = 100%, core/settings/ ≥ 95%, core/billing/ ≥ 95%, core/analytics/ ≥ 90%.
  • Random-test-ordering proven clean under 6 different seeds.
  • mypy strict clean across 275 source files.
  • ruff check + format clean across 409 files.
  • scripts/stealth_whitelist_check.py clean.
  • scripts/translate_check.py clean.
  • scripts/parameters_codegen.py --check clean.

Known limitations (deferred / future)

These are not launch blockers — each is documented and the runtime degrades gracefully.

ItemWhy deferredImpact at launch
tdata / tdlib session importersMulti-file binary formats specific to Telegram Desktop; significant reverse-engineering workUsers must convert to Pyrogram or Telethon session before import
Stories pollingTelegram's stories API requires stories.incrementStoryViews which is on the forbidden listStories feature is not active; documented; UI shows "Premium" placeholder
Multi-region deployment (Tier C1)Single-region production is sufficient at the launch traffic estimateDocumented; scales to ~5 regions before requiring this
Cold storage backend choice (Tier C2)ClickHouse vs S3+Parquet vs long-Postgres — operator decisionLong-Postgres works; retention policy already configurable
Property + fuzz tests (Tier C4)Investment opportunity, not a launch blockerExisting 784 tests + multi-seed sweep cover the contract surface
Soak / load tests (Tier C5)Test infrastructure setup, not a code gapSingle-host throughput estimated from synthetic generator; soak suite is a post-launch task
Broadcast composer / promos / persona-editor Mini App pagesOperator workflows that have CLI fallbacks via the parameters catalogOperators use the existing Owner Mini App parameters tree + direct DB during early launch
Web portal (ADR-0007) OIDC handshakeportal.html build emits but OIDC flow not wiredMini App is the primary surface; portal is a planned post-launch enhancement
Media compactor (ADR-0009)Per-file AVIF/Opus/AV1/zstd pipelineMedia stored as-is for now; the storage backend has the slot structure ready for the compactor

Audit trail

68 atomic commits since sprint 0:

  • Sprint 0: foundation (parameters, stealth, button-only bot)
  • Phase 1-43: every Tier A piece + first plugin layer
  • Phase 44-47: chat tracking end-to-end
  • Phase 48-49: predictions + GDPR purger
  • Phase 50-53: warmup + identity capture
  • Phase 54-56: analytics resolver + first wiring
  • Phase 57: tg_channel + file_archive
  • Phase 58: random-ordering flake fix
  • Phase 59: CryptoBot
  • Phase 60: tg_topic + external_bot
  • Phase 61: resolver wired into heatmap/daily/predict
  • Phase 62: discord + slack
  • Phase 63: Telethon .session
  • Phase 64: email
  • Phase 65: cryptapi + xrocket + ton_connect
  • Phase 66: backup drill + onboarding docs
  • Phase 67: final verification

Every commit shipped with its own test suite. The full suite has been green at every commit. Random-test-ordering safety was explicitly proven (phase 58 + phase 67's seed sweep).

Launch protocol

Open the bot to a controlled cohort (≤ 50 paying clients) for the first 14 days. Monitor:

  • helios:events stream depth (target: < 1000 events lagged)
  • API p99 latency (target: ≤ 250 ms)
  • Stealth violations rate (target: 0)
  • Payment-webhook success rate (target: ≥ 99.5%)

Burn-rate alerts on each of the above are already deployed.

Quarterly backup drill begins one week after launch (see docs/operations/backup-drill.md).

One-paragraph summary

Helios is a multi-tenant SaaS for Telegram presence intelligence with stealth-first userbot capture, RLS-enforced multi-tenancy, a 93-parameter runtime registry, 9 delivery channels, 5 payment providers, 4 session importers, hybrid tier-aware analytics caching, automated GDPR-compliant data lifecycle, Prometheus observability, mkdocs-strict documentation, and 784 tests passing under random ordering. The codebase has been disciplined since sprint 0 — every tunable is a Parameter, every userbot RPC is on the stealth whitelist, every client-scoped table has its RLS policy, every external integration is a Protocol implementation. Ready for v1 launch.

On this page