feat(exit): forgiven exit — open the exit barrier with no payment (barrier:create)
Build & push images / images (push) Successful in 3m23s
Build & push images / images (push) Successful in 3m23s
The owner (or any role the owner grants barrier:create) lets a car out for free.
Exit side only. Every use is signed, attributed, photographed and on the operator's
Z-report; the shift's cash/card/drawer are untouched by construction.
- shared: resource 'barrier' + permission 'barrier:create'; reason codes
exit.forgiven / exit.forgiven.noSession; LedgerPayload.forgoneMinor.
- pay-station: forgive() signs a $0 payment carrying the quoted fee as forgoneMinor
(no tender), refuses a ticket with module charge lines (a wash is not forgiven).
- exit-flow: reopenBarrier(..., { forgiven }) bypasses the walk-back check and stamps
the forgiven reason on the anomaly + vehicle_exit; forgiveExitNoSession() for a car
with no ticket (anomaly under forgiven:<id> + exit snapshot + pulse). Relay driving
shared in #pulseExit.
- route POST /api/barrier/forgive { identity?, note? }: barrier:create + open shift;
the reason is optional (an empty note is signed as '(no reason given)').
- shift-service: forgoneTotalMinor + forgoneCount on the report/summary/signed
shift_z_report (only when > 0), print line 'Dalje të falura (N)'.
- web: 'Forgive & open' in the pay/exit modal for an open transient that owes money;
'Forgive & open exit' on the booth header for the no-ticket case; forgone line on
the X-report, close confirm and history; en/sq. Prints nothing.
- tests: exit-flow, pay-station, shift-service, HTTP route (403 without the
permission, 409 no shift, empty note accepted, ledger sequence, report figures).
- wiki: decisions/forgiven-exit.md (decision + as-built), booth-exit-flow, shift,
index, log.
This commit is contained in:
@@ -204,6 +204,17 @@ filter shows a `matched/total` count). No new API — filtering is over data alr
|
||||
segment — **booth** (operator-initiated, `source: manual`) vs **reader** (device-initiated:
|
||||
wiegand/lpr/qr/ticket). Filters are scoped within the current shift window, as the feed already is.
|
||||
|
||||
## Forgiven exit — open with NO payment (built 2026-10-08)
|
||||
|
||||
The one human-intervention open that is allowed to skip the payment: an operator holding
|
||||
**`barrier:create`** (admin by default; the owner grants it per role) lets a car out for free.
|
||||
Decision + as-built in [[forgiven-exit]]. In short: a ticketed car gets a **$0 `payment`
|
||||
carrying `forgoneMinor`** (the fee it owed) then the same re-open path as above (anomaly +
|
||||
`vehicle_exit` with `exit.forgiven`); a car with no session gets an anomaly under a
|
||||
`forgiven:<id>` ref + the pulse. Reason optional, open shift required, **nothing printed**,
|
||||
and the forgone amount is its own Z-report line — never inside cash/card ([[shift]]). The
|
||||
no-unpaid-bypass rule above still holds for everyone without that permission.
|
||||
|
||||
## ⚠ Open question — walk-back grace renews on every payment (voucher overstay)
|
||||
|
||||
> **Update 2026-06-20 — pricing half resolved; grace-renewal half still open.** The overstay work
|
||||
|
||||
@@ -113,6 +113,16 @@ no variance gate, no manager override.
|
||||
> shared via `formatStampSq` from [[rongta-printer]]. Consistent with the "[[i18n|printed paper is
|
||||
> always Albanian]]" rule — independent of the operator's UI language.
|
||||
|
||||
### Forgiven exits on the Z-report (built 2026-10-08)
|
||||
|
||||
A [[forgiven-exit]] is a signed `payment` with `amountMinor: 0` and `forgoneMinor` = the fee
|
||||
waived, no tender. It adds **nothing** to cash, card, the ticket bucket or the drawer (the
|
||||
tender sums add 0), so the shift total is untouched by construction. The Z-report sums
|
||||
`forgoneMinor` into `forgoneTotalMinor` + `forgoneCount`, stamps them on the signed
|
||||
`shift_z_report` (only when > 0, so older payloads stay identical) and prints one line
|
||||
`Dalje të falura (N): X` after the merchant-validation leakage line — a separate figure on
|
||||
purpose, so the owner can tell "the bar validated it" from "the operator let it out".
|
||||
|
||||
### Shift history UI + permission scoping (2026-06-19)
|
||||
A read-only **shift-history screen** (`GET /api/shifts`) lists completed shifts — each a signed
|
||||
`shift_z_report` folded for its figures (no re-summing), newest-first, expandable to the drawer
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
---
|
||||
type: decision
|
||||
tags: [parking, decisions, exit, barrier, threat-model, shift, z-report, permissions]
|
||||
sources: []
|
||||
updated: 2026-10-08
|
||||
status: 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: "forgiven exit by X — fee of N CUR waived: <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 të falura (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 a "Forgive & open exit" next to the exit lane light for the no-ticket case
|
||||
(`window.prompt` for the reason — Cancel aborts, empty proceeds). Both only render with
|
||||
`barrier:create` + own open 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).
|
||||
@@ -140,6 +140,7 @@ Counts: 4 sources · 19 entities · 47 concepts · 8 decision records.
|
||||
- [[vision-service]] — build a host-side ANPR + vehicle-verification service; replaces edge-LPR; scoped AGPL exception.
|
||||
- [[bodytype-classifier-training]] — phase B (SUV vs sedan): `apps/trainer` trains on the collector host (time split, floor, features/finetune modes, feature cache) → report → publish to the Gitea generic package → `models/bodytype.version` pin bakes it into the vision image → TAG bump; sidecar = the preprocessing contract; CPU-only torch on the Xeon E3-1225 v5, Quadro FX 3800 unusable, cloud GPU rejected. Built 2026-09-07; first run waits for labels.
|
||||
- [[device-discovery-roadmap]] — memo (open): how each known device class gets a wizard Scan — SADP + ONVIF for cameras (verified on the lab VLAN), 9100 sweep + fingerprint for printers, Dingtian relay multicast search, Dahua 37810; the reusable method and rules from the DT-008 work.
|
||||
- [[forgiven-exit]] — decision + as-built (2026-10-08): owner opens the EXIT barrier with no payment — a signed zero-amount payment carrying the forgone fee as its own Z-report line (never in cash/card), exit only, admin permission + open shift, reason optional, prints nothing.
|
||||
- [[vision-service-packaging]] — the vision service lives in this monorepo (apps/vision/), separate process, wired into Turbo via a package.json shim; uv-managed Python.
|
||||
- [[event-streams-split]] — split the signed business ledger (ledger_events) from unsigned device telemetry (device_events).
|
||||
- [[desktop-shell-tauri]] — ✅ Tauri v2 chosen over Electron for the desktop kiosk shell; thin wrapper, server keeps all logic. Best case Ubuntu 26.04 LTS (resolves WebKitGTK); worst case Windows+WSL → kiosk browser, no native shell. Auto-updater mirrors signed releases to public `mca/public_releases` (source repo is private — field appliances have no Gitea creds).
|
||||
|
||||
+23
@@ -3467,3 +3467,26 @@ records one PASS sample per detection (best-framed vehicle of its poll loop →
|
||||
`pass:<id>` + vehicle read with `deviceId`); the Car Wash sampler dedups per camera for 30 s so a
|
||||
ticketed car is not sent twice. Also flushed park-2's 21 backed-off rows (`next_attempt_at = now`)
|
||||
so the reviewer got the day's backlog at once. Pages: [[vision-review-outbox]] §entry stream.
|
||||
|
||||
## [2026-10-08] decision | Forgiven exit (owner opens the exit barrier, no money)
|
||||
|
||||
Discussed, narrowed to EXIT only, pinned as [[forgiven-exit]] (status: decided, not built):
|
||||
zero-amount signed payment carrying `forgoneMinor` as its own Z-report line so the shift's
|
||||
cash/card/drawer are untouched by construction; no-session cars get an anomaly + pulse; admin
|
||||
permission, open shift, mandatory reason, prints nothing, no cap. Entry side rejected.
|
||||
|
||||
## [2026-10-08] ingest | Forgiven exit built (barrier:create)
|
||||
|
||||
"Ok, can we implement that? But the owner can give permission to other operators to do
|
||||
that." Built per [[forgiven-exit]]: new permission `barrier:create` (grantable per role),
|
||||
`PayStation.forgive` ($0 payment carrying `forgoneMinor`, no tender, refuses wash charges),
|
||||
`ExitFlow.reopenBarrier(..., { forgiven })` + `forgiveExitNoSession`, route
|
||||
`POST /api/barrier/forgive`, Z-report `forgoneTotalMinor`/`forgoneCount` + print line, modal
|
||||
"Forgive & open" + booth-header "Forgive & open exit" (no ticket), en/sq. Prints nothing.
|
||||
Pages: [[forgiven-exit]], [[booth-exit-flow]] §Forgiven exit, [[shift]] §Forgiven exits.
|
||||
|
||||
## [2026-10-09] decision | Forgiven exit: reason is optional
|
||||
|
||||
"We don't need to force the user to write a reason." Route no longer 400s without a note; an
|
||||
empty note is signed as "(no reason given)"; modal confirm enabled with an empty box; booth
|
||||
prompt: Cancel aborts, empty proceeds; en/sq texts say optional. [[forgiven-exit]] §5 updated.
|
||||
|
||||
Reference in New Issue
Block a user