Legacy/function inventory cleanup – 2026-05-18
Scope
Цель прохода: найти функции и контракты, которые могли потеряться в ходе эволюции Crisis-Monitor, и убрать только доказанно неиспользуемое наследие.
Runtime facts
- Production entrypoint remains
wsgi:appvia Gunicorn indocker-compose.prod.yml. wsgi:apppoints to the Flask app fromapp.create_app().app/main.pycontains the FastAPI migration layer, but production does not run it as the primary app today.- Flask route inventory from
create_app(TESTING=True): 335 routes. - Template static pass: no orphan HTML templates found;
404.htmland500.htmlare referenced dynamically by the error handler.
Recovered / reconnected
utils.postmortem_report.generate_postmortem_reportwas referenced by tests and docs but the module was absent. The implementation existed inutils.report_utils; restored a compatibility wrapper that accepts a ticket id.app.services.media_integration.search_archive_photosexisted but was not used./api/media/searchnow calls it instead of duplicating QazLake search logic in Flask/FastAPI routers.
Removed as proven dead
- Legacy SQLAlchemy models
InformationPlanandInformationPlanConfigurationinapp/models/misc.py. Current code usesInformationResponsePlan; no migrations reference the oldinformation_planorinformation_plan_configurationtables. - Unreferenced helper
utils.analytics.top_types. - Unreferenced report helpers
utils.report_utils.get_report_dataandutils.report_utils.get_sla_compliance_report. - Duplicate Telegram helpers
services.telegram_bot.notify_ticket_createdandnotify_ticket_updated. Runtime notification paths areapp.telegram_alerts.*,utils.telegram.send_formatted_message, and/api/v1/notify/ticket/{ticket_id}. - Stale docs/runtime claims that described the FastAPI app as the production primary entrypoint. Production compose runs
wsgi:app;app/main.pyremains the migration/development ASGI surface. - Stale OpenAPI schema name
InformationPlan; the active model and API payload areInformationResponsePlan. - Unused Apprise notification wrapper and
APPRISE_URLSconfig surface. The active notification paths are Telegram/API/email-specific services, and Apprise was not referenced by any runtime caller.
Not removed yet
app/main.pyandapp/routers/*: looks stale relative to production, but still useful as the FastAPI migration surface. Removing it would be architectural.- skipped Phase 8 router tests: noisy, but they document unfinished FastAPI migration expectations.
utils/cap_parser.py: not wired to a runtime route, but it is the only helper for external CAP Atom feed ingestion. Kept and covered with unit tests instead of deleting it as dead code.app.services.media_integration.attach_media_to_ticket: mentioned in the old module docstring but never implemented. Documented as a missing contract rather than adding a guessed attachment workflow.