Files
julian 2ac26b5825
Build & push images / images (push) Successful in 3m20s
feat(booth): the exit lane light is the manual-exit control — two tiles, Hyrje and Dalje Manuale
BarrierLight gains onOpen/opening (not presence-gated). For an operator with
barrier:create + own shift the exit tile is labelled 'manual exit', clickable and
opens the manual-exit dialog while still showing the lane state; for everyone else it
stays the plain 'Dalje' light. The separate ghost button is removed. Wiki as-built note.
2026-10-09 09:17:16 +02:00

7.4 KiB

type, tags, sources, updated, status
type tags sources updated status
decision
parking
decisions
exit
barrier
threat-model
shift
z-report
permissions
2026-10-08 built 2026-10-08

Forgiven exit — the owner opens the EXIT barrier with no payment

Built 2026-10-08 (same day as decided). As-built notes at the end of this page; the decisions below are what shipped.

The ask (user, 2026-10-08). The owner/admin sometimes needs to let a car out regardless: a transient that took a ticket but will not be charged, or a car with no session at all (it came in while the barriers were up). The open must produce no money and must be flagged in the live feed. First floated for both directions; narrowed the same day to the EXIT barrier only — the entry keeps its existing paths (operator-issued-entry when the button is broken, barriers physically up otherwise).

Why it is safe to give the operator this at all

This is the exact move the threat-model worries about (pocket the fee, "lose" the ticket, let the car out). As with operator-issued-entry, the defence is not to withhold the capability but to make every use signed, attributed, photographed and impossible to hide: it lands on a named operator's shift, with the fee it forgave, where the owner reads it.

Decisions

  1. Exit only. Reuses the human-intervention re-open path in exit-flow.ts (reopenBarrier: anomaly signed FIRST, then the human-intervention vehicle_exit, exit snapshot, pulseOpen). Today that path refuses an unpaid or grace-expired transient; the feature is a second authorization branch on it, behind a dedicated permission.
  2. Accounting: a signed ZERO-amount payment that carries the forgone fee. The Z-report (shift) sums amountMinor by tender, so a zero payment adds nothing to cash, card or the drawer — the shift total is untouched by construction. The fee the car owed is recorded in its own field (forgoneMinor, with a reason code), reported as its own line ("forgone exits: N, amount X"), and is NOT the merchant-validation discountMinor — the owner must be able to tell "the bar validated it" from "the operator let it out". Signing the payment also closes the ticket, so it cannot be reused (plate-reconciliation ticket-swap).
  3. No session (car has no ticket, e.g. came in with the barriers up): signed anomaly with the exit snapshot and the plate read, then the pulse. Nothing to forgive, nothing to close.
  4. Permission: a new one, admin only by default; the owner decides whether operators get it. Requires an open shift (same requireShift as the pay routes) so every use is on someone's report.
  5. Reason text is OPTIONAL (user, 2026-10-09 — reversed from "mandatory" the day before: "We don't need to force the user to write a reason"). The accountability is the signature, the operator name, the snapshot and the Z-report line; an empty note is signed as "(no reason given)" so the English sentence stays readable.
  6. Print nothing. No receipt, no slip — there is no payment to receipt (user, 2026-10-08).
  7. Visibility: warn-level log line, anomaly in the live feed with the snapshot, the Z-report line. No cap, no blocking — blocking the owner at the gate recreates the "lot stuck" problem; the defence is reporting.
  8. Safety unchanged: pulseOpen only, never a timed close (fail-state-safety).

Not decided / out of scope

  • Entry-side free open: rejected for now (the entry has its own paths).
  • Whether a forgiven exit should also void an attached car-wash charge line: open; today the zero payment would carry no charge lines at all.

Build sketch (when asked)

exit-flow.reopenBarrier(identity, operator, { forgive: { reason } }) → quote the fee as the pay flow would (PayStation quote), sign payment { amountMinor: 0, forgoneMinor, reason }, then the existing re-open body. Route POST /api/barrier/forgive with the new permission + requireShift. Z-report: forgoneTotalMinor + forgoneCount (old reports → 0), one print line. Web: a guarded button in the pay/exit modal, reason field optional. Reason codes: exit.forgiven, exit.forgiven.noSession. Tests on the no-money invariant (cash/card/drawer unchanged) and on the ticket being closed.

As built (2026-10-08)

  • Permission barrier:create (new resource barrier in the code-defined grid, packages/shared). Admin has it by the all-permissions invariant; the owner grants it to any role from Setup → Roles — "the owner can give permission to other operators" (user).
  • PayStation.forgive(identity, { operator, note }) — quotes the fee as the pay flow would, signs payment { amountMinor: 0, forgoneMinor: <quote>, operator, reasonCode: "exit.forgiven", reason: "manual exit by X — fee of N CUR, no payment: <note>" } with no tender (nothing was tendered), marks the projection paid. Refuses (409) when the quote carries module charge lines (a wash on the ticket): parking is forgiven, a wash is not.
  • ExitFlow.reopenBarrier(id, operator, { forgiven }) — the existing human-intervention re-open with the walk-back check bypassed for a forgiven call (a 0-minute grace tariff must not refuse it); the anomaly and the vehicle_exit carry exit.forgiven + forgiven: true
    • forgoneMinor. ExitFlow.forgiveExitNoSession(operator, note) — anomaly under a fresh forgiven:<uuid> identity (so its exit snapshot shows in the feed) + pulse; no payment, no exit event. Relay driving shared in #pulseExit (signed first; a failed pulse is ok:true, opened:false + "open by hand").
  • Route POST /api/barrier/forgive { identity?, note? } — barrier:create + the open-shift gate (409 no_shift); the note is optional; no identity = the no-session path.
  • Z-report: forgoneTotalMinor + forgoneCount summed from forgoneMinor (never into cash/card; discountTotalMinor untouched), on the signed shift_z_report only when > 0, one print line Dalje manuale (N): X, shown in the X-report, the close confirm and history.
  • Web: in the pay/exit modal a red ghost "Forgive & open" for an OPEN transient that owes money (unpaid or overstay) → reason box → "Confirm — open exit, no payment"; on the booth header the exit lane light itself is the control for the no-ticket case (user, 2026-10-09: "only Hyrje and Dalje Manuale") — same chrome as the entry light, still showing the lane state, labelled "Dalje manuale" and clickable → a small styled dialog (optional reason, red confirm). For anyone without barrier:create + own open shift it is the plain "Dalje" light. The modal button likewise only renders with the permission + shift. Live-feed reason texts in en/sq. Nothing is printed.
  • Tests: exit-flow (ticketed + no-session), pay-station (forgive), shift-service (totals untouched, own line, history), routes (403 without the permission, 409 no shift, 400 no note accepted, ledger sequence entry→payment→anomaly→exit, report figures).

Wording (user, 2026-10-09). The user-facing words are "manual exit" / "dalje manuale", not forgive/forgiven/forgone — too much "fal, falur, falje" (user). Applies to both language files, the printed Z-report line (Dalje manuale (N)) and the signed English fallback sentences. Internal names stay (exit.forgiven, forgoneMinor, barrier:create) — they are code identifiers, not copy.