chore(core): stage 1 contracts — dialog, API schemas + fixtures, integrations, monitoring, modules
CI / ruff · pytest (pull_request) Successful in 22s
CI / ruff · pytest (pull_request) Successful in 22s
Freeze interfaces between lanes A (bot), B (backend), C (dashboard) so three developers work in parallel without touching each other's files: dialog Event/Reply + engine registry with echo stub, integration protocols with in-memory defaults, MonitoringService with noop stub, /api/v1 schemas with fixture-backed routes, frozen main.py wiring, config/modules.yaml + due_scales(), DAR-5, tzdata, Andrey trajectory, lanes in WORKFLOW, ADR-010. Refs #34 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+10
-2
@@ -1,4 +1,4 @@
|
||||
"""Application entrypoint: FastAPI API (+ scheduler and Telegram bot once implemented)."""
|
||||
"""Application entrypoint: FastAPI API + scheduler + Telegram bot (frozen wiring, #34)."""
|
||||
|
||||
import logging
|
||||
from collections.abc import AsyncGenerator
|
||||
@@ -7,9 +7,12 @@ from contextlib import asynccontextmanager
|
||||
from fastapi import FastAPI
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
|
||||
from app.api.routes import router
|
||||
from app.channels import telegram
|
||||
from app.config import get_settings
|
||||
from app.db.bootstrap import init_db
|
||||
from app.db.session import dispose
|
||||
from app.scheduler import jobs as scheduler
|
||||
|
||||
# Logs carry only tokens, states and event codes — never PII or raw message text.
|
||||
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(name)s %(message)s")
|
||||
@@ -27,12 +30,17 @@ async def lifespan(_: FastAPI) -> AsyncGenerator[None, None]:
|
||||
# In compose Postgres is required and healthy before the app starts; this branch is for running the
|
||||
# API (and its tests) without a database. Endpoints touching the DB will fail until it is reachable.
|
||||
log.error("db init failed, continuing without db: %s", type(exc).__name__)
|
||||
# Scheduler (#13) and Telegram bot (#11) hook in here.
|
||||
# Lanes fill these in (#13, #11); main.py itself stays frozen (#34).
|
||||
await scheduler.start()
|
||||
await telegram.start()
|
||||
yield
|
||||
await telegram.stop()
|
||||
await scheduler.stop()
|
||||
await dispose()
|
||||
|
||||
|
||||
app = FastAPI(title="PTSRaiAgent API", version="0.1.0", lifespan=lifespan)
|
||||
app.include_router(router)
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
|
||||
Reference in New Issue
Block a user