feat: foundations for the manager conversion (platform-v2 step 6.1)

- Backend: every HTTPException in routers/ is an error code now (260 raises, ~105 new codes,
  texts in en + el); XeniaError(detail=...) keeps the three v1-shaped answers old pages read;
  bad / unknown tokens answer auth.session_ended; test_errors refuses new HTTPExceptions.
- Manager: v2.json is the list of pages on the v2 rules: scripts/lint.mjs lints them,
  tests/v2-guards.test.mjs refuses Greek and colour literals, `strict` paths make
  set-state-in-effect an error.
- src/live/useLiveQuery.js (react-query + live events + refresh on reconnect); Signed in now
  uses it.
- Dead manager files removed (3.1k lines unreachable from main.jsx).
- Tests: backend 544 passed, manager unit 33, run-all (no Android) passed (manager's live
  bell check passed on a rerun).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 04:31:36 +02:00
co-authored by Claude Opus 5.5
parent 218a6c9c5e
commit 2dc5da446e
48 changed files with 918 additions and 3498 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
from core import i18n, timeutil
from core.errors import XeniaError
from core.timeutil import utcnow
from fastapi import APIRouter, Depends, HTTPException
from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session
from datetime import datetime, timezone
@@ -52,7 +52,7 @@ def update_setting(
user: User = Depends(require_settings_manager),
):
if key not in valid_settings():
raise HTTPException(status_code=400, detail=f"Unknown setting key: {key}")
raise XeniaError("settings.unknown_key", key=key)
from core.modules.registry import setting_defs
sd = setting_defs()[key][0]
if (sd.type == "enum" and body.value not in sd.choices) or (sd.type == "bool" and body.value not in ("true", "false")) or (sd.type == "int" and not body.value.lstrip("-").isdigit()):
@@ -66,7 +66,7 @@ def update_setting(
raise XeniaError("validation.unknown_language", language=body.value)
if key == "business_day.rollover_hour":
if not (body.value.isdigit() and 0 <= int(body.value) <= 23):
raise HTTPException(status_code=422, detail="rollover_hour must be 0-23")
raise XeniaError("validation.range", status=422, field='rollover_hour', min=0, max=23)
setting = db.query(PosSettings).filter(PosSettings.key == key).first()
if setting: