This document tracks framework deprecations that affect Quail and provides a minimal migration plan. It is intended for future LLM or human work; no behavior changes should be made without explicit approval.
FastAPI is deprecating @app.on_event("startup") in favor of lifespan handlers.
Quail currently uses on_event to initialize logging, the database, and default
settings.
Low today, but future FastAPI releases may remove on_event, causing startup
errors.
- Add a lifespan context manager and move the current startup logic into it.
- Remove the
@app.on_event("startup")function. - Ensure the same initialization order is preserved.
Snippet (structure only, preserve existing calls):
from contextlib import asynccontextmanager
@asynccontextmanager
async def lifespan(app: FastAPI):
configure_logging()
settings = get_settings()
db.init_db(settings.db_path)
_init_settings(settings.db_path)
yield
app = FastAPI(title="Quail", lifespan=lifespan)Starlette prefers TemplateResponse(request, "name.html", context) instead of
TemplateResponse("name.html", context). Warnings are raised in tests and CI.
Low today, but future Starlette releases may enforce the new signature.
- Replace all
TemplateResponse("template.html", {...})calls withTemplateResponse(request, "template.html", {...}). - Keep context dictionaries identical, including
"request": request. - Re-run the test suite to confirm no template regressions.
Snippet (before/after):
# before
return templates.TemplateResponse("message.html", {"request": request, ...})
# after
return templates.TemplateResponse(request, "message.html", {"request": request, ...})- CI warnings about
on_eventandTemplateResponseare cleared. - No change to behavior or rendered HTML output.
- Admin/login flows and message rendering pages still load normally.