fix: Backend-Start nach Tandoor-Router-Import
All checks were successful
Deploy Development / deploy (push) Successful in 1m4s
Build Test / pytest-backend (push) Successful in 4s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 22s

Future-annotations plus Limiter haben TandoorProbeIn unauflösbar gemacht.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Lars 2026-09-13 10:40:13 +02:00
parent d6838abda7
commit 3b46630a37
4 changed files with 16 additions and 4 deletions

View File

@ -184,6 +184,12 @@ known_limitations=(
**Regel:** Kein Join „Name der Liste gegen alle Tagebuchzeilen“. Datum aus der bereits gesetzten FK oder aus dem Eltern-Datensatz.
## 10. `from __future__ import annotations` + FastAPI-Limiter (13.09.2026)
**Was:** `tandoor.py` mit future-annotations und `body: TandoorProbeIn | None` unter `@limiter.limit`.
**Problem:** Pydantic löst den Typ nicht auf → Import-Crash → Backend startet nicht → Login bekommt HTML (`Unexpected token '<'`).
**Lösung:** Kein future-annotations in Routern; `Optional[TandoorProbeIn]`. Import-Test für den Router.
---
**Zusammenfassung Nutrition Cluster:**

View File

@ -1,6 +1,4 @@
"""Per-user Tandoor connection. No recipe import yet."""
from __future__ import annotations
from typing import Optional
from fastapi import APIRouter, Depends, HTTPException
@ -59,7 +57,7 @@ def write_settings(body: TandoorSettingsIn, session: dict = Depends(require_auth
@router.post("/test")
@limiter.limit("10/minute")
def test_connection(request: Request, body: TandoorProbeIn | None = None, session: dict = Depends(require_auth)):
def test_connection(request: Request, body: Optional[TandoorProbeIn] = None, session: dict = Depends(require_auth)):
pid = session["profile_id"]
body = body or TandoorProbeIn()
with get_db() as conn:

View File

@ -1,6 +1,14 @@
from data_layer.tandoor_client import TandoorError, normalize_base_url, public_settings, token_hint
def test_tandoor_router_imports():
from routers import tandoor
paths = {r.path for r in tandoor.router.routes}
assert "/api/tandoor/settings" in paths
assert "/api/tandoor/test" in paths
def test_normalize_https_strips_slash():
assert normalize_base_url("https://tandoor.stommer.de/") == "https://tandoor.stommer.de"

View File

@ -21,7 +21,7 @@ MODULE_VERSIONS = {
"caliper": "1.0.1",
"activity": "1.2.1", # Legacy CSV import: activity_entries feature enforcement
"nutrition": "1.3.3", # Unmapped ohne Kreuzjoin; Listen-Import Rebuild async
"tandoor": "1.0.0", # Per-user URL + Token + Verbindungstest
"tandoor": "1.0.1", # Router-Import ohne future-annotations (Backend startet)
"bls": "1.0.5", # GET /bls/units
"photos": "1.0.0",
"insights": "1.3.0",