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
+27
View File
@@ -97,3 +97,30 @@ def test_unknown_order_on_real_api(client, make_user, login): # plan step 1.2 "
assert r.status_code == 404
assert r.json()["error"] == {"code": "order.not_found", "params": {"order_id": 999999},
"message": "Order 999999 not found."}
def test_backend_code_raises_codes_not_http_exceptions():
"""Step 6.1: every error the app raises is a registered code (XeniaError) with texts in
both languages; a plain HTTPException would reach the apps as an untranslated `http.<status>`."""
import pathlib
import re
root = pathlib.Path(__file__).resolve().parents[1]
found = [f"{p.relative_to(root)}:{n}" for d in ("routers", "services", "core", "modules")
for p in (root / d).rglob("*.py") if p.name != "errors.py"
for n, line in enumerate(p.read_text(encoding="utf-8").splitlines(), 1)
if re.search(r"\bHTTPException\s*\(", line)]
assert found == [], "use XeniaError (core/errors.py) instead: " + ", ".join(found)
def test_a_code_can_keep_a_v1_shaped_detail():
app = FastAPI()
install_error_handlers(app)
@app.get("/x")
def x():
raise XeniaError("business_day.orders_open", open_orders=2, partially_paid=1,
detail={"message": "2 tables open", "open_orders": 2, "partially_paid": 1})
body = TestClient(app).get("/x").json()
assert body["error"]["code"] == "business_day.orders_open" and body["error"]["params"] == {"open_orders": 2, "partially_paid": 1}
assert body["detail"]["open_orders"] == 2