From 7529bc19497a84ea2de4b98cac26b78c54dd27f7 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 6 Jul 2026 11:14:35 +0200 Subject: [PATCH] =?UTF-8?q?docs:=20README=20=E2=80=94=20data=20is=20wired?= =?UTF-8?q?=20to=20live=20MariaDB=20+=20reject=20writes=20(was=20"currentl?= =?UTF-8?q?y=20SAMPLE")?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Overview reads live MariaDB and POST /reject writes since 2026-07-02. Replaced the "wire it (TODO)" section with the live wiring; noted the HTTP-200+{success:false} contract and the rejTtId column added by fastpress migration 009; collapsed the resolved open questions (per-ttId booking + belt semantics), leaving only the login-free-write security question open. Co-Authored-By: Claude Opus 4.8 (1M context) --- README.md | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 7e37ab3..5d420ff 100644 --- a/README.md +++ b/README.md @@ -90,32 +90,33 @@ Belt colour mapping (matches PressV process colours): `notYetSent`→violet, `wagen`→cyan, `unterwegs`→amber, `ofen`→orange, `fertig`→emerald; the reject accent is Grafana dark-red `#C4162A`. -### Wiring the REAL data (currently SAMPLE) +### Live data wiring -`api/routes.py` returns sample data and `POST /reject` echoes success **without -writing**. To make it live (see the `TODO` there + `.claude/memory/ausschuss-station.md`): +`api/routes.py` reads live MariaDB and `POST /reject` writes (details in the gateway +memory `.claude/memory/ausschuss-station.md`; `sample:true` only in the standalone dev +fallback). Via `from .._db import run_select_query, transaction`: -- `from .._db import run_select_query, transaction`. -- **overview:** read `production.temper_tracking` across **all** presses (un-scoped), - one row per `ttId`, newest first by `ttOutOfOvenAt` (`ttStatus='done'`); join - `active_orders`/`finished_orders` for the article. Add each order's 5-station - distribution — reuse `modules/fastpress/press/temper.py::_temper_aggregates_all` - (notYetSent / sentToTemper / onWayToOven / inOven / finishedTempering). Filter by - `window` on `ttOutOfOvenAt`. +- **overview:** reads `production.temper_tracking` across **all** presses (un-scoped), + one row per `ttId`, newest-first by `ttOutOfOvenAt` (`ttStatus='done'`), joined to + `active_orders`/`finished_orders`, windowed on `ttOutOfOvenAt`. The order-level + 5-station distribution reuses `modules/fastpress/press/temper.py::_temper_aggregates_all`. - **reasons:** `SELECT id, reason_de, reason_en FROM settings.reject_reasons WHERE active=1`. -- **reject:** one `INSERT` into `production.rejects` inside a `transaction()` — same - shape as `modules/fastpress/press/rejects.py::send_reject`. Booking references the - cart, which needs an **additive nullable `rejTtId` column** (a DBA applies it; the - runtime account has no `ALTER`). The device-scoped `POST /press/rejects/send` - can't be reused — it derives the press from the device JWT; here `press`+`ttId` - come from the body. +- **reject:** one `INSERT` into `production.rejects` inside a `transaction()` (an + un-scoped reuse of PressV `send_reject`), keyed by `rejOrdernumber`+`rejPress` from + the body — the device-scoped `POST /press/rejects/send` can't be reused (it derives + the press from the device JWT). ⚠ `/reject` returns **HTTP 200 + `{success:false}`** + on failure (not 4xx/5xx — else the frontend store swallows it into a fake success). -### Open questions before go-live (from the design memory) +Note: a nullable `rejTtId` column was later added (fastpress migration 009) so rejects +attribute to the correct press cycle — see the gateway memory +`temper-cycle-reject-attribution.md`. -1. **Security of the login-free write:** network/reverse-proxy restriction only, or a - static `STATION_TOKEN` in `.env`? (No TLS/reverse-proxy exists yet.) -2. Confirm the `rejTtId` column name + that per-`ttId` booking is desired (yes, per spec). -3. Belt semantics: order-level distribution (chosen) vs. the cart's own journey position. +### Open question before go-live + +**Security of the login-free write:** network/reverse-proxy restriction only, or a +static `STATION_TOKEN` in `.env`? (No TLS/reverse-proxy exists yet.) Because this +terminal **writes**, resolve this before exposing it beyond a trusted LAN. (Resolved: +per-`ttId` booking is desired; belt shows the order-level distribution.) ---