Skip to content
This repository was archived by the owner on Jun 15, 2026. It is now read-only.
This repository was archived by the owner on Jun 15, 2026. It is now read-only.

Automated testing strategy #158

@anomit

Description

@anomit

Is your feature request related to a problem?

Yes. This repo’s snapshotter path has selection-aware process_task, deferred preloader-failure handling, batched MISSED_SNAPSHOT Telegram reporting, and related reconcile logic. Recent reviews noted that automated tests are still narrow: helpers such as format_missed_batch_summary are covered, but higher-risk paths—reconciliation on success/failure, send-not-before backoff, retry scheduling, preloader defer + reconcile—lack regression coverage. Without dev test dependencies and a CI step that runs them, mistakes can ship (for example, await on a synchronous defer_preloader_failure_notification). A small guard exists under snapshotter/tests/, but CI does not consistently install/run pytest from the Poetry graph.

Describe the solution you'd like

  1. Dependencies — Add pytest (and minimal async tooling if adopted, e.g. pytest-asyncio) under [tool.poetry.group.dev.dependencies] in pyproject.toml, refresh poetry.lock, and document the test command in the README or CONTRIBUTING if present.
  2. CI — Add a workflow job that installs with dev groups and runs e.g. poetry run pytest snapshotter/tests/ (adjust scope as needed).
  3. Docker / production image — Use poetry install --no-root --without dev (or Poetry 2 --only main / equivalent) in the Dockerfile so the runtime image does not ship pytest (negligible incremental image size for production).
  4. Tests (phased) — Add integration-style tests when bandwidth allows: stub httpx for Telegram, fake or temp-file SlotSelectionTracker, cover _try_reconcile_preloader_missed, _flush_missed_batch / retry paths, and the preloader-defer → reconcile flow.

Describe alternatives you've considered

  • unittest only — No extra dev deps; weaker ergonomics for async and fixtures.
  • pip install pytest in CI only — Works but diverges from the lockfile and local dev setup.
  • Separate test image with dev deps — Heavier pipeline; optional follow-up.

Additional context

  • Broader tests were intentionally deferred to a future release after landing safety fixes in application code; this issue tracks pytest in dev + CI + Docker split and phased test depth.
  • Image size: keeping pytest in the dev group and excluding dev from the production poetry install keeps runtime image impact at ~0; installing pytest as a main dependency without excluding dev in Docker would add on the order of ~5–20 MB under site-packages (rough estimate).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions