fix(ci): corriger les 16 erreurs ruff et resynchroniser le littéral de version

Lint (run 2304, job 7058, ruff check app tests) : E402+I001 import mcp_server remonté en tête de app/main.py ; B904 x8 dans api_v2/templates_io.py (raise ... from None, from exc pour ValueError) ; UP017 datetime.UTC dans agent_evenements.py ; F841 x3 dans fd_templates.py (void/uid morts, import inutilisé retirés en chaîne) ; F401+F841 dans tests/test_fd_templates.py (import json inutilisé, n_presets en appel nu).

Version : le test test_pwa_offline cherche le littéral version="7.82.0" dans app/main.py — patron historique des bumps (scripts/bump_version.py le cherche aussi), rompu en 7.80.2 quand l'argument FastAPI est passé à _lire_version(). Littéral reposé en commentaire de synchronisation explicite, version runtime inchangée (lecture dynamique VERSION).
This commit is contained in:
Spark
2026-10-25 19:26:09 +00:00
parent f8449409b2
commit 49164ce057
5 changed files with 19 additions and 21 deletions
+8 -8
View File
@@ -235,9 +235,9 @@ def get_fd_template_v2(template_id: str, request: Request, authorization: str |
row = TemplateService.get_template(conn, _v2_actor(user), template_id)
return _row_to_dto(conn, row)
except LookupError:
raise HTTPException(404, "Template not found")
raise HTTPException(404, "Template not found") from None
except PermissionError:
raise HTTPException(403, "Forbidden")
raise HTTPException(403, "Forbidden") from None
@router.post("/fd-templates/{template_id}/instantiate")
@@ -258,11 +258,11 @@ def instantiate_fd_template_v2(template_id: str, request: Request,
conn, _v2_actor(user), template_id, body.get("variables") or {},
body.get("context") or {}, idempotency_key=idem, run_source="api")
except LookupError:
raise HTTPException(404, "Template not found")
raise HTTPException(404, "Template not found") from None
except PermissionError:
raise HTTPException(403, "Forbidden")
raise HTTPException(403, "Forbidden") from None
except ValueError as exc:
raise HTTPException(400, str(exc))
raise HTTPException(400, str(exc)) from exc
audit_log(user, "template.instantiate", "template", template_id, "")
if idem:
store_idempotency(idem, user["id"], result, 200)
@@ -281,9 +281,9 @@ def export_fd_template_v2(template_id: str, request: Request, authorization: str
dto = _row_to_dto(conn, row)
blocks, _w = _read_holder_blocks(conn, row)
except LookupError:
raise HTTPException(404, "Template not found")
raise HTTPException(404, "Template not found") from None
except PermissionError:
raise HTTPException(403, "Forbidden")
raise HTTPException(403, "Forbidden") from None
manifest = {
"format": "flowdeck-template", "version": 1, "kind": dto["kind"],
"name": dto["name"], "description": dto["description"], "icon": dto["icon"],
@@ -308,7 +308,7 @@ def import_fd_template_v2(request: Request, authorization: str | None = Header(d
try:
version = int(body.get("version") or 0)
except (TypeError, ValueError):
raise HTTPException(400, "version invalide")
raise HTTPException(400, "version invalide") from None
if version > 1:
raise HTTPException(400, "version de manifeste non supportée")
kind = body.get("kind") or "page"