feat(booth): cancel wrongly-printed ticket (signed void) + refused-vs-anomaly display; fix CI uv
CI / check (push) Failing after 56s
CI / check (push) Failing after 56s
Cancel a misprinted/test/wrong-vehicle ticket via a SIGNED `void` event — the
vehicle_entry is never edited/deleted (append-only). VoidFlow appends void{
voidedEntryRef, voidReason, operator, reasonCode:"void.ticketCancelled" }; route
POST /api/tickets/void gated event:void + open shift; reason REQUIRED. Refuses a
subscription / already-exited / already-voided / paid ticket (refund out of scope).
The void folds the session CLOSED everywhere it's counted — occupancy (count +
reserved spots), pay-station (lookup/activeSessions), exit-flow (#sessionFor), and
reports (excluded from entries) — so a voided car stops occupying a spot, can't be
paid/exited, and doesn't inflate "cars entered". No barrier action. Booth UI: a
"Cancel ticket" action in the pay/exit lookup modal (transient + unpaid + open;
gated on event:void) with a preset-or-free reason prompt.
Reclassify the Live feed: refused-action events (exitRefused/entryRefused/
permitRefused — e.g. a double card-scan, at-capacity subscriber, exit on a closed
session) are benign warnings, not red anomalies. event-detail.tsx now shows them as
amber REFUZUAR/REFUSED, reserving red ANOMALI for genuine red-flags. Display-only —
no ledger change, so historical events reclassify too.
CI: install uv + sync vision deps before the Turbo run. @parking/vision's lint/
typecheck/test shell to `uv run …`, but CI set up only Node+pnpm, so `uv run ruff`
failed ("uv not found") and broke the whole Turbo run. The Python checks pass once
uv provisions the toolchain.
- new: void-flow.ts (+ tests, 8) ; occupancy void-fold test
- shared: reason code void.ticketCancelled ; both web catalogs (sq/en parity)
- wiki: parking-session (ticket-void folds + guards, refused/anomaly split), log
Claude-Session: https://claude.ai/code/session_01Xcm6ikLgGoCxxHrxtjkk5V
This commit is contained in:
@@ -73,6 +73,34 @@ States, as derived from events:
|
||||
|
||||
Permit sessions skip PAID: a valid [[subscription]] at exit is itself the authorization to close.
|
||||
|
||||
### Cancel a wrongly-printed ticket — BUILT (2026-06-22)
|
||||
|
||||
A ticket printed in error (misprint, test press, wrong vehicle) is cancelled by appending a **signed
|
||||
`void`** event — the `vehicle_entry` is NEVER edited or deleted (append-only; [[append-only-event-chain]]).
|
||||
`apps/server/src/void-flow.ts` (`VoidFlow`) appends `{ type:"void", identity, payload:{ sessionRef,
|
||||
voidedEntryRef:<entry id>, voidReason, operator, reasonCode:"void.ticketCancelled" } }`. Traceable: the
|
||||
operator (from the JWT) + a **REQUIRED reason** are signed in. Route `POST /api/tickets/void` gated on
|
||||
`event:void` + an open shift. **No barrier action** — a misprinted ticket's car never entered.
|
||||
|
||||
- **Refused** for: a subscription occurrence (closed via its own flow), an already-exited session, an
|
||||
already-voided ticket, or a **paid** ticket (a refund is a separate, out-of-scope action) → 409.
|
||||
- **The void folds the session CLOSED everywhere it's counted** — this is the correctness crux. A
|
||||
`void` decrements like a `vehicle_exit` in `occupancy.ts` (count + reserved-spots), and reads as
|
||||
closed in `pay-station.ts` (`lookup`/`activeSessions`) and `exit-flow.ts` (`#sessionFor`), and is
|
||||
excluded from the `reports.ts` entries stat. So a voided car stops occupying a spot, can't be
|
||||
paid/exited, and doesn't inflate "cars entered". The booth surfaces it in the pay/exit lookup modal
|
||||
(transient + unpaid + open only).
|
||||
|
||||
### Live-feed display: refused-action WARNING vs. genuine ANOMALY
|
||||
|
||||
The signed ledger `type:"anomaly"` is overloaded: it carries both benign **refused-action** events
|
||||
(`exitRefused` / `entryRefused` / `permitRefused` — e.g. a double card-scan, an at-capacity
|
||||
subscriber, an exit on an already-closed session) AND genuine red-flags (barrier-open failure,
|
||||
opened-without-ticket). The booth feed now classifies from those existing payload flags
|
||||
(`event-detail.tsx isRefusedWarning`) and shows the refused ones as an amber **REFUZUAR / REFUSED**
|
||||
warning, reserving red **ANOMALI** for true anomalies. **Display-only** — no ledger type/data change,
|
||||
so historical events reclassify correctly too.
|
||||
|
||||
## Edge cases the model must name (not yet designed in full)
|
||||
|
||||
- **Overstay after payment** — exited the grace window; needs a top-up payment. The one genuinely
|
||||
|
||||
Reference in New Issue
Block a user