3 Commits

Author SHA1 Message Date
julian 1f63a7063c wiki: users and permissions for the new booth, TypeScript with Docker
New decision page booth-users-and-permissions: identity has its home in
the platform and the booth is in constant two-way sync, local login from
the copy, product keys auth and parking, 37 proposed keys with all 44 of
today's permissions mapped, two jobs, the rules, key-pair signing, what
the platform needs, and what is left to the sync design.

Hub page event-driven-refactor: the decisions of 2026-11-23 on users and
permissions, validation and car wash out of the booth (postponed), and
the language (TypeScript with Docker; Rust abandoned).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RZgP5oZdzvo92Eouc9eRv5
2026-11-23 17:46:58 +01:00
julian dd2dd53d7e wiki: H.264 test on park-lab, event-driven refactor decided
- zone-anpr-poc: H.264 instead of MJPEG (load, delay, a car in the zone,
  staff traffic, bad weather); the relay-less test copy is left running
- event-driven-refactor (new): the user's decisions of 2026-11-23, what
  is not decided, what they touch in today's code; waits for the user's
  guidelines
- passage-confirmation: the 2026-11-19 phase order superseded; where the
  video work lives
- vision-hardening, zone-anpr-poc-review: on-screen label read as a
  plate (moved by the user), day-time oversized box, still pause carried
  over
- pointers on vision-service, camera-live-view, lane-presence-and-anpr-entry,
  dingtian-vs-mqtt, entry gates, standing decisions, open questions,
  overview, index

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RZgP5oZdzvo92Eouc9eRv5
2026-11-23 12:02:18 +01:00
julian 980a3e5178 poc(zone-anpr): live picture, H.264 metrics, one decode thread
- /live/<camera>.mjpg: the newest decoded frame with the vehicle boxes,
  re-encoded once for all viewers; idle while nobody watches
- the page shows that stream instead of polling a still every 700 ms
- metrics: stream codec, seconds to the first picture, viewers, live
  frames a second, network in
- config: decode_threads (CAP_PROP_N_THREADS; 1 removes the frames the
  H.264 decoder holds back per extra thread), live_quality

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RZgP5oZdzvo92Eouc9eRv5
2026-11-23 12:02:18 +01:00
20 changed files with 1248 additions and 31 deletions
+90 -9
View File
@@ -338,7 +338,12 @@ class Camera:
self.frame_no = 0 self.frame_no = 0
self.cond = threading.Condition() self.cond = threading.Condition()
self.status = "starting" self.status = "starting"
self.stats = dict(decoded=0, received=0, snap_ms=0.0, hires=0, hires_ms=0.0, det_runs=0, det_ms=0.0, read_runs=0, read_ms=0.0, saves=0, verdicts=0) self.stats = dict(decoded=0, received=0, snap_ms=0.0, hires=0, hires_ms=0.0, det_runs=0, det_ms=0.0, read_runs=0, read_ms=0.0, saves=0, verdicts=0, live=0)
# The live picture for the page: every decoded frame re-encoded as JPEG, ONCE per frame
# for all viewers, and only while somebody watches (2026-11-23, the H.264 test).
self.live_viewers, self.live_jpeg, self.live_no = 0, None, 0
self.live_cond = threading.Condition()
self.codec, self.first_frame_s = None, None # what the camera sends; connect -> first picture
self.present = False self.present = False
# One lane, two cameras (entry and exit watch the same lane from both ends): only one # One lane, two cameras (entry and exit watch the same lane from both ends): only one
# camera may hold a visit at a time. The other YIELDS, and stays yielded until its own # camera may hold a visit at a time. The other YIELDS, and stays yielded until its own
@@ -519,21 +524,56 @@ class Camera:
# --- stream mode: decode everything, keep the newest # --- stream mode: decode everything, keep the newest
def grab_stream(self): def grab_stream(self):
if True: if True:
cap = cv2.VideoCapture(self.url, cv2.CAP_FFMPEG) t0 = time.time()
# FFmpeg decodes H.264 on several threads by default, and each extra thread holds one
# more frame back: 5 frames on the 6-core booth PC, 0.4 s at 12.5 fps (measured
# 2026-11-23). decode_threads: 1 gives each frame out as soon as it is decoded.
n = self.app.cfg.get("decode_threads")
cap = (cv2.VideoCapture(self.url, cv2.CAP_FFMPEG, [cv2.CAP_PROP_N_THREADS, int(n)]) if n
else cv2.VideoCapture(self.url, cv2.CAP_FFMPEG))
if not cap.isOpened(): if not cap.isOpened():
raise ConnectionError("cannot open stream") raise ConnectionError("cannot open stream")
self.status = "live" self.status = "live"
log(self.name, "stream open", self.safe_url(), fcc = int(cap.get(cv2.CAP_PROP_FOURCC))
self.codec = "".join(chr((fcc >> 8 * i) & 0xFF) for i in range(4)).strip("\x00 ") or "?"
log(self.name, "stream open", self.safe_url(), self.codec,
int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)), "x", int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))) int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)), "x", int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))
first = True
while True: while True:
ok, f = cap.read() ok, f = cap.read()
if not ok: if not ok:
self.status = "stream lost" self.status = "stream lost"
log(self.name, "stream lost, reconnecting") log(self.name, "stream lost, reconnecting")
break break
if first:
first, self.first_frame_s = False, round(time.time() - t0, 2)
log(self.name, f"first picture {self.first_frame_s} s after connecting")
self.publish(frame=f) self.publish(frame=f)
cap.release() cap.release()
# --- live picture: one JPEG per decoded frame, shared by all viewers, idle with none
def live_loop(self):
seen = 0
q = int(self.app.cfg.get("live_quality", 75))
while True:
with self.live_cond:
self.live_cond.wait_for(lambda: self.live_viewers > 0)
with self.cond:
self.cond.wait_for(lambda: self.frame_no != seen, timeout=2)
if self.frame_no == seen:
continue
f, _, seen = self.latest()
if f is None:
continue
img = f.copy() # the boxes must not land on the frame the detector and the clip use
for x1, y1, x2, y2, *_ in list(self.last_vehicles):
cv2.rectangle(img, (int(x1), int(y1)), (int(x2), int(y2)), (0, 255, 0), 2)
jpeg = cv2.imencode(".jpg", img, [cv2.IMWRITE_JPEG_QUALITY, q])[1].tobytes()
self.stats["live"] += 1
with self.live_cond:
self.live_jpeg, self.live_no = jpeg, self.live_no + 1
self.live_cond.notify_all()
# --- worker: presence in zone → plate # --- worker: presence in zone → plate
def work(self): def work(self):
period = 1.0 / self.app.cfg["detect_fps"] period = 1.0 / self.app.cfg["detect_fps"]
@@ -1273,14 +1313,24 @@ class App:
a = list(map(int, open("/proc/stat").readline().split()[1:])) a = list(map(int, open("/proc/stat").readline().split()[1:]))
return sum(a), a[3] + a[4] return sum(a), a[3] + a[4]
def net_rx(): # bytes received on the machine's real network cards (host network)
n = 0
for ln in open("/proc/net/dev").read().splitlines()[2:]:
name, rest = ln.split(":", 1)
if name.strip().startswith(("en", "eth", "wl")):
n += int(rest.split()[0])
return n
cpu0, _ = proc() cpu0, _ = proc()
h0 = host() h0 = host()
n0 = net_rx()
t0 = time.time() t0 = time.time()
prev = {c.name: dict(c.stats) for c in self.cams} prev = {c.name: dict(c.stats) for c in self.cams}
while True: while True:
time.sleep(self.cfg["metrics_s"]) time.sleep(self.cfg["metrics_s"])
cpu1, rss = proc() cpu1, rss = proc()
h1 = host() h1 = host()
n1 = net_rx()
t1 = time.time() t1 = time.time()
dt = t1 - t0 dt = t1 - t0
tot, idle = h1[0] - h0[0], h1[1] - h0[1] tot, idle = h1[0] - h0[0], h1[1] - h0[1]
@@ -1288,12 +1338,15 @@ class App:
proc_cores=round((cpu1 - cpu0) / dt, 2), proc_cores=round((cpu1 - cpu0) / dt, 2),
proc_pct_of_host=round(100 * (cpu1 - cpu0) / dt / NCPU, 1), proc_pct_of_host=round(100 * (cpu1 - cpu0) / dt / NCPU, 1),
host_busy_pct=round(100 * (tot - idle) / tot, 1) if tot else None, host_busy_pct=round(100 * (tot - idle) / tot, 1) if tot else None,
rss_mb=round(rss / 2**20), load1=os.getloadavg()[0], cams={}) rss_mb=round(rss / 2**20), load1=os.getloadavg()[0],
net_rx_mbps=round((n1 - n0) * 8 / dt / 1e6, 2), cams={})
for c in self.cams: for c in self.cams:
s, p = c.stats, prev[c.name] s, p = c.stats, prev[c.name]
d = {k: s[k] - p[k] for k in s} d = {k: s[k] - p[k] for k in s}
m["cams"][c.name] = dict( m["cams"][c.name] = dict(
status=c.status, mode=c.mode, fps=round(d["received"] / dt, 1), status=c.status, mode=c.mode, codec=c.codec, first_frame_s=c.first_frame_s,
live_viewers=c.live_viewers, live_per_s=round(d["live"] / dt, 1),
fps=round(d["received"] / dt, 1),
decoded_per_s=round(d["decoded"] / dt, 1), decoded_per_s=round(d["decoded"] / dt, 1),
snap_ms=round(d["snap_ms"] / d["received"], 1) if c.mode == "snapshot" and d["received"] else None, snap_ms=round(d["snap_ms"] / d["received"], 1) if c.mode == "snapshot" and d["received"] else None,
det_per_s=round(d["det_runs"] / dt, 1), det_per_s=round(d["det_runs"] / dt, 1),
@@ -1303,12 +1356,12 @@ class App:
read_ms=round(d["read_ms"] / d["read_runs"], 1) if d["read_runs"] else None, read_ms=round(d["read_ms"] / d["read_runs"], 1) if d["read_runs"] else None,
saves=d["saves"], verdicts=d["verdicts"], present=c.present) saves=d["saves"], verdicts=d["verdicts"], present=c.present)
prev[c.name] = dict(s) prev[c.name] = dict(s)
cpu0, h0, t0 = cpu1, h1, t1 cpu0, h0, n0, t0 = cpu1, h1, n1, t1
with self.io_lock, open(self.out / "metrics.jsonl", "a") as fh: with self.io_lock, open(self.out / "metrics.jsonl", "a") as fh:
fh.write(json.dumps(m) + "\n") fh.write(json.dumps(m) + "\n")
log("metrics", f"proc {m['proc_cores']} cores ({m['proc_pct_of_host']}% of host)", log("metrics", f"proc {m['proc_cores']} cores ({m['proc_pct_of_host']}% of host)",
f"rss {m['rss_mb']} MB", f"host {m['host_busy_pct']}%", f"rss {m['rss_mb']} MB", f"host {m['host_busy_pct']}%", f"net in {m['net_rx_mbps']} Mbps",
" | ".join(f"{n}: {v['mode']} {v['fps']} in/s, {v['decoded_per_s']} dec/s" " | ".join(f"{n}: {v['mode']} {v['codec']} {v['fps']} in/s, {v['decoded_per_s']} dec/s, live {v['live_per_s']}/s x{v['live_viewers']}"
+ (f", snap {v['snap_ms']} ms" if v['snap_ms'] else "") + f", det {v['det_ms']} ms, reads {v['reads']}" + (f", snap {v['snap_ms']} ms" if v['snap_ms'] else "") + f", det {v['det_ms']} ms, reads {v['reads']}"
+ (f" (hi-res {v['hires_ms']} ms)" if v['hires_ms'] else "") + "" + (f" (hi-res {v['hires_ms']} ms)" if v['hires_ms'] else "") + ""
f" @ {v['read_ms']} ms" for n, v in m["cams"].items())) f" @ {v['read_ms']} ms" for n, v in m["cams"].items()))
@@ -1317,6 +1370,7 @@ class App:
for c in self.cams: for c in self.cams:
threading.Thread(target=c.grab, daemon=True, name=f"grab-{c.name}").start() threading.Thread(target=c.grab, daemon=True, name=f"grab-{c.name}").start()
threading.Thread(target=c.work, daemon=True, name=f"work-{c.name}").start() threading.Thread(target=c.work, daemon=True, name=f"work-{c.name}").start()
threading.Thread(target=c.live_loop, daemon=True, name=f"live-{c.name}").start()
threading.Thread(target=self.metrics, daemon=True, name="metrics").start() threading.Thread(target=self.metrics, daemon=True, name="metrics").start()
Handler.app = self Handler.app = self
srv = ThreadingHTTPServer(("0.0.0.0", self.cfg["http_port"]), Handler) srv = ThreadingHTTPServer(("0.0.0.0", self.cfg["http_port"]), Handler)
@@ -1391,7 +1445,7 @@ async function saveZone(n){const z=S.zone[n]||[];if(z.length<3)return alert('Nee
await fetch('zone/'+n,{method:'POST',body:JSON.stringify(z)});S.zone[n]=[];last=await (await fetch('status')).json();draw()} await fetch('zone/'+n,{method:'POST',body:JSON.stringify(z)});S.zone[n]=[];last=await (await fetch('status')).json();draw()}
async function tick(){ async function tick(){
try{last=await (await fetch('status')).json(); try{last=await (await fetch('status')).json();
for(const c of last.cams){document.getElementById('i-'+c.name).src='frame/'+c.name+'.jpg?'+Date.now(); for(const c of last.cams){{const im=document.getElementById('i-'+c.name);if(!im.dataset.live){im.dataset.live=1;im.onerror=()=>{delete im.dataset.live};im.src='live/'+c.name+'.mjpg?'+Date.now()}}
document.getElementById('s-'+c.name).textContent=`${c.status} · ${c.present?'ZONE BUSY'+(c.crossing?' · last crossing '+({'a-to-b':'A → B (in)','b-to-a':'B → A (out)'})[c.crossing]:' · no crossing yet'):c.yielded?'lane busy (other camera)':c.busy?'vehicle in zone (no visit)':'empty'}${c.side?' · car '+({a:'on side A',b:'on side B',line:'on the line'})[c.side]:''}${c.read?' · '+c.read:''}`} document.getElementById('s-'+c.name).textContent=`${c.status} · ${c.present?'ZONE BUSY'+(c.crossing?' · last crossing '+({'a-to-b':'A → B (in)','b-to-a':'B → A (out)'})[c.crossing]:' · no crossing yet'):c.yielded?'lane busy (other camera)':c.busy?'vehicle in zone (no visit)':'empty'}${c.side?' · car '+({a:'on side A',b:'on side B',line:'on the line'})[c.side]:''}${c.read?' · '+c.read:''}`}
const R=last.relays;relaybar.innerHTML=!R.configured?'Relays: not configured': const R=last.relays;relaybar.innerHTML=!R.configured?'Relays: not configured':
(R.armed?`<b style="color:#f55">RELAYS ARMED</b> — R1 opens on a car in the zone. R2 (close) ${R.close_live?'<b style="color:#f55">is LIVE: it closes the real barrier on an abandoned open</b>':'stays a dry run (logged only)'}. Auto-disarm in ${Math.ceil(R.armed_left_s/60)} min. <button onclick="fetch('disarm',{method:'POST'})">Disarm</button>` (R.armed?`<b style="color:#f55">RELAYS ARMED</b> — R1 opens on a car in the zone. R2 (close) ${R.close_live?'<b style="color:#f55">is LIVE: it closes the real barrier on an abandoned open</b>':'stays a dry run (logged only)'}. Auto-disarm in ${Math.ceil(R.armed_left_s/60)} min. <button onclick="fetch('disarm',{method:'POST'})">Disarm</button>`
@@ -1466,6 +1520,33 @@ class Handler(BaseHTTPRequestHandler):
return self.send(200, json.dumps(dict(cams=cams, reads=reads, visits=visits, relays=relays)).encode(), "application/json") return self.send(200, json.dumps(dict(cams=cams, reads=reads, visits=visits, relays=relays)).encode(), "application/json")
if self.path == "/relaystatus": # a status read on demand: moves nothing if self.path == "/relaystatus": # a status read on demand: moves nothing
return self.send(200, json.dumps(a.relays.status()).encode(), "application/json") return self.send(200, json.dumps(a.relays.status()).encode(), "application/json")
m = re.match(r"^/live/([\w-]+)\.mjpg", self.path)
if m: # the live picture: multipart JPEG, newest frame only (a slow viewer skips frames)
c = next((c for c in a.cams if c.name == m.group(1)), None)
if c is None:
return self.send(404, b"no camera", "text/plain")
self.send_response(200)
self.send_header("Content-Type", "multipart/x-mixed-replace; boundary=frame")
self.send_header("Cache-Control", "no-store")
self.end_headers()
with c.live_cond:
c.live_viewers += 1
c.live_cond.notify_all()
seen = c.live_no
try:
while True:
with c.live_cond:
if not c.live_cond.wait_for(lambda: c.live_no != seen, timeout=10):
continue
jpeg, seen = c.live_jpeg, c.live_no
self.wfile.write(b"--frame\r\nContent-Type: image/jpeg\r\nContent-Length: "
+ str(len(jpeg)).encode() + b"\r\n\r\n" + jpeg + b"\r\n")
except OSError:
pass # the viewer went away
finally:
with c.live_cond:
c.live_viewers -= 1
return
m = re.match(r"^/frame/([\w-]+)\.jpg", self.path) m = re.match(r"^/frame/([\w-]+)\.jpg", self.path)
if m: if m:
c = next((c for c in a.cams if c.name == m.group(1)), None) c = next((c for c in a.cams if c.name == m.group(1)), None)
+5 -1
View File
@@ -2,7 +2,7 @@
type: concept type: concept
tags: [parking, entry, anti-fraud, safety, devices] tags: [parking, entry, anti-fraud, safety, devices]
sources: [] sources: []
updated: 2026-07-04 updated: 2026-11-23
status: open status: open
--- ---
@@ -72,6 +72,10 @@ configured, a press is live **only while the entry lane's camera confirms a vehi
never traps a car. A camera-less site keeps the radar-only gate; a faulty camera is dropped via the never traps a car. A camera-less site keeps the radar-only gate; a faulty camera is dropped via the
admin [[entry-presence-bypass]] (`bypassPresenceCamera`), same as the operator-issued path. admin [[entry-presence-bypass]] (`bypassPresenceCamera`), same as the operator-issued path.
> **2026-11-23 (user):** this gate stays as built under the event-driven refactor. When a camera
> gives no signal, the admin bypass ([[entry-presence-bypass]]) is the way to unblock the ticket
> ([[event-driven-refactor]]).
### REJECTED: camera-vetoed re-arm (the queue trap) ### REJECTED: camera-vetoed re-arm (the queue trap)
The obvious fix for the stationary-car dropout — *don't re-arm on loop-clear while the camera still The obvious fix for the stationary-car dropout — *don't re-arm on loop-clear while the camera still
sees a car; re-arm when the lane flips free* — was designed and **rejected** (2026-07-04). The sees a car; re-arm when the lane flips free* — was designed and **rejected** (2026-07-04). The
+4 -1
View File
@@ -2,7 +2,7 @@
type: concept type: concept
tags: [parking, entry, admin, devices, threat-model, presence] tags: [parking, entry, admin, devices, threat-model, presence]
sources: [] sources: []
updated: 2026-07-04 updated: 2026-11-23
status: settled status: settled
--- ---
@@ -15,6 +15,9 @@ radar, a camera that stopped pushing ([[g3h-anpr-push-gotchas|it happens]]) —
**legitimate** transient entry until support fixes the hardware. This feature lets the **admin** **legitimate** transient entry until support fixes the hardware. This feature lets the **admin**
drop a specific signal as a requirement until then. Built 2026-07-02 (migration `0020`). drop a specific signal as a requirement until then. Built 2026-07-02 (migration `0020`).
> **2026-11-23 (user):** this bypass is the mechanism that unblocks entry when a camera or a
> radar gives no signal, also under the event-driven refactor ([[event-driven-refactor]]).
## The principle: the admin is NOT the adversary ## The principle: the admin is NOT the adversary
The [[threat-model]] adversary is the **booth operator**; the admin is the trusted party. So the The [[threat-model]] adversary is the **booth operator**; the admin is the trusted party. So the
@@ -2,12 +2,17 @@
type: concept type: concept
tags: [parking, camera, anpr, subscription, lane, vision] tags: [parking, camera, anpr, subscription, lane, vision]
sources: [] sources: []
updated: 2026-10-11 updated: 2026-11-23
status: open status: open
--- ---
# Lane Presence & ANPR Subscriber Entry # Lane Presence & ANPR Subscriber Entry
> **2026-11-23:** the bridge described here has the server pull the still and post it to the
> vision service. The user decided that the server holds no video or image work and takes a
> camera's signal as one way in among several ([[event-driven-refactor]]). Not built; this page
> describes what runs today.
Two related things a camera's vehicle detection feeds, worked out over a long field session Two related things a camera's vehicle detection feeds, worked out over a long field session
(2026-06-22, see [[lpr-camera]] for the camera-side saga + the corrected "it was the undrawn (2026-06-22, see [[lpr-camera]] for the camera-side saga + the corrected "it was the undrawn
detection area" conclusion): detection area" conclusion):
+5 -1
View File
@@ -2,7 +2,7 @@
type: concept type: concept
tags: [parking, booth, entry, threat-model, anpr, presence] tags: [parking, booth, entry, threat-model, anpr, presence]
sources: [] sources: []
updated: 2026-07-04 updated: 2026-11-23
status: settled status: settled
--- ---
@@ -14,6 +14,10 @@ to mint entries — so it is **flagged, presence-gated, and paired with an exit
([[plate-reconciliation]]). Built 2026-07-01. Companion to [[entry-exit-points]] (the entry flow it ([[plate-reconciliation]]). Built 2026-07-01. Companion to [[entry-exit-points]] (the entry flow it
reuses) and [[capacity-occupancy]]. reuses) and [[capacity-occupancy]].
> **2026-11-23 (user):** this gate stays as built under the event-driven refactor. When a camera
> gives no signal, the admin bypass ([[entry-presence-bypass]]) is the way to unblock the ticket
> ([[event-driven-refactor]]).
## Why give the operator this at all ## Why give the operator this at all
An operator *could* mint tickets to defraud — but a broken entry button otherwise **blocks the whole An operator *could* mint tickets to defraud — but a broken entry button otherwise **blocks the whole
lot**, which is worse and more common. So the feature exists, and the fraud it enables is defended lot**, which is worse and more common. So the feature exists, and the fraud it enables is defended
+25 -2
View File
@@ -2,7 +2,7 @@
type: concept type: concept
tags: [parking, vision, barrier, lane, ledger, safety, design] tags: [parking, vision, barrier, lane, ledger, safety, design]
sources: [] sources: []
updated: 2026-11-22 updated: 2026-11-23
status: open status: open
--- ---
@@ -110,7 +110,7 @@ Two cameras mounted on **one physical lane that serves both directions** (user,
|---|---|---| |---|---|---|
| Address | `10.0.10.6` | `10.0.10.7` | | Address | `10.0.10.6` | `10.0.10.7` |
| Model | DS-2CD1083G2-LIU (8MP, V5.8.4) | DS-2CD1043G2-LIU (4MP, V5.8.10) | | Model | DS-2CD1083G2-LIU (8MP, V5.8.4) | DS-2CD1043G2-LIU (4MP, V5.8.10) |
| Sub-stream (102) | 1280×720 **MJPEG**, 12.5 fps (was 640×360 H.264, keyframe every 4 s) | 1280×720 **MJPEG**, 20 fps (was 640×360 H.264, keyframe every 2.5 s) | | Sub-stream (102) | 1280×720 **H.264**, 12.5 fps, keyframe every 0.96 s (since 2026-11-23; MJPEG from 2026-11-17 until then) | 1280×720 **H.264**, 20 fps, keyframe every 1 s (since 2026-11-23; MJPEG from 2026-11-17 until then) |
| Line crossing / intrusion (`ISAPI/Smart/LineDetection`, `FieldDetection`) | `notSupport` | `notSupport` | | Line crossing / intrusion (`ISAPI/Smart/LineDetection`, `FieldDetection`) | `notSupport` | `notSupport` |
| Motion detection | on, target `vehicle`, grid drawn | on, target `vehicle`, grid drawn | | Motion detection | on, target `vehicle`, grid drawn | on, target `vehicle`, grid drawn |
| Alarm server (`httpHosts`) | the dev machine `10.0.10.203:3000` (user, 2026-11-19) | the dev machine `10.0.10.203:3000` (user, 2026-11-19) | | Alarm server (`httpHosts`) | the dev machine `10.0.10.203:3000` (user, 2026-11-19) | the dev machine `10.0.10.203:3000` (user, 2026-11-19) |
@@ -203,6 +203,11 @@ signal.*
### Phase-1 order (user, 2026-11-19) ### Phase-1 order (user, 2026-11-19)
> **Superseded (user, 2026-11-23).** The PoC as it ran on 2026-11-22 met the user's requirements
> and is the reference for building this into the parking system: the zone flow, the relay rules
> and the live close, as decided on 2026-11-22 below. The staged order in this section and the
> "Phase-1 shape" after it are kept as history and no longer bind the work.
The audit record comes first, because it actuates nothing: no relay, no interlock, no safety The audit record comes first, because it actuates nothing: no relay, no interlock, no safety
review. review.
@@ -353,6 +358,24 @@ build had to pick a default for each; they are listed on [[zone-anpr-poc]]:
the check is not atomic. It does not replace the series interlock, which stays a precondition the check is not atomic. It does not replace the series interlock, which stays a precondition
for a live R2. for a live R2.
## Where the video work lives (user, 2026-11-23)
Decided by the user, and now part of a refactor of the whole repository:
[[event-driven-refactor]] has the full list, what is not decided, and what it touches in the code.
- **The server holds no video or image work.** The vision side talks to the cameras, decodes
whatever they send, and produces what the rest needs.
- **The server is agnostic about the camera side.** A camera's signal is one way in among
several; without it an RF card, a barcode or a push-button ticket does the job. The server does
nothing special when a camera is blind or dead. For this page that keeps the rule "no signal,
no close".
- **A bus connects the vision side, the server and the booth screen.** How the booth gets its
picture and how the vision side gets the camera logins settle with the user's guidelines.
- **Tried the same day:** the PoC decoding H.264 sub-streams costs the same CPU as MJPEG and an
eighth of the network ([[zone-anpr-poc]], "H.264 instead of MJPEG").
- Today the server still holds the live-view stream, pulls and re-encodes the stills, and reads
picture sizes ([[camera-live-view]], `apps/server/src/snapshot.ts`). Nothing has been moved.
## Open questions ## Open questions
- **Hardening the vision side** after the field trials: the work list, deferred on 2026-11-22, is - **Hardening the vision side** after the field trials: the work list, deferred on 2026-11-22, is
+28 -4
View File
@@ -2,7 +2,7 @@
type: concept type: concept
tags: [parking, vision, anpr, passage, night, glare, hardening, poc, park-lab] tags: [parking, vision, anpr, passage, night, glare, hardening, poc, park-lab]
sources: [] sources: []
updated: 2026-11-22 updated: 2026-11-23
--- ---
# Vision hardening — what the zone PoC left open # Vision hardening — what the zone PoC left open
@@ -25,6 +25,8 @@ Evidence for every item is on [[zone-anpr-poc]] (flow, relays, live closes) and
- **The user's reading (2026-11-22):** the wet lens is the culprit and the weather cannot be - **The user's reading (2026-11-22):** the wet lens is the culprit and the weather cannot be
fixed. park-lab is also the worst case there is: one lane for both directions, and a boom that fixed. park-lab is also the worst case there is: one lane for both directions, and a boom that
crosses the exit camera's picture. crosses the exit camera's picture.
- **Again on 2026-11-23 (user):** bad weather during the staff's morning traffic; the cameras are
outdoors and the weather cannot be fixed ([[zone-anpr-poc]], "Staff traffic").
## The picture itself (camera side) ## The picture itself (camera side)
@@ -50,6 +52,9 @@ Nothing in the software removes flare from a wet lens. None of these has been tr
wide, against 81–99% for the glare boxes, so size alone will not separate them. wide, against 81–99% for the glare boxes, so size alone will not separate them.
- **To try:** a visit starts only on a box that has held for a few looks; a box that touches - **To try:** a visit starts only on a box that has held for a few looks; a box that touches
both the left and the right edge of the picture is not a car. both the left and the right edge of the picture is not a car.
- By day too (2026-11-23, 09:01 UTC, exit camera): a box 824 px wide and 703 of 720 px high
over the grey mass in front of the lens, with a car's rear at its edge. It touches the left
edge only, so the both-edges rule would not catch it.
2. **The followed car goes unmatched more often at night.** The detector held its 5 looks a second 2. **The followed car goes unmatched more often at night.** The detector held its 5 looks a second
throughout (`metrics.jsonl`), but in several night visits the car was matched in only 3.1–4.1 of throughout (`metrics.jsonl`), but in several night visits the car was matched in only 3.1–4.1 of
them. Each miss is a look in which the car's side is not known. Not investigated. them. Each miss is a look in which the car's side is not known. Not investigated.
@@ -97,6 +102,20 @@ Nothing in the software removes flare from a wet lens. None of these has been tr
11. **No format rule (user, 2026-11-21).** Items 5–8 are checks on the picture. A rule about what 11. **No format rule (user, 2026-11-21).** Items 5–8 are checks on the picture. A rule about what
a plate looks like stays out. a plate looks like stays out.
**Added 2026-11-23:** the camera's on-screen label is read as a plate. The entry camera prints
"Hyrje" into the picture, bottom right, where a car's bumper stands when it is at the line. The
plate reader takes it for a plate (`HUIJE`), in video frames and in stills, and on 2026-11-23 one
still was sure enough to vote ([[zone-anpr-poc]], "H.264 instead of MJPEG"). **To try:** take the
label and the clock out of the picture in the camera's settings, or keep a plate box that falls on
a printed overlay from voting.
- **Done by the user (2026-11-23):** the labels "Hyrje" and "Dalje" now sit in the top-right
corner of both cameras' pictures, in the video and in the hi-res still, away from the zone and
from where a car stands. A tall vehicle reached it the same morning: an off-roader's box rose
to y = 37 of 720 with the label inside it (08:53 UTC). The label was not read then, nor in any
other of the staff's eight visits. That is one vehicle, so the overlay check stays on the
list.
## Flow and the close ## Flow and the close
12. **A car the detector loses inside the zone.** The code's default gives `unclear` and no close. 12. **A car the detector loses inside the zone.** The code's default gives `unclear` and no close.
@@ -164,10 +183,15 @@ Nothing in the software removes flare from a wet lens. None of these has been tr
on park-lab. on park-lab.
- **On park-lab:** container `zg2`, page on port 8094, files in `~/zone-anpr-gpu`. **It is stopped - **On park-lab:** container `zg2`, page on port 8094, files in `~/zone-anpr-gpu`. **It is stopped
since the evening of 2026-11-22** (user: the barrier is operated only with the staff's remote since the evening of 2026-11-22** (user: the barrier is operated only with the staff's remote
control until the system is ready to control it). `docker start zg2` brings it back with the control until the system is ready to control it). `docker start zg2` brings it back with
committed `zone_anpr.py`, `close_live` and `close_on_lost` on, and the relays disarmed. Do not `close_live` and `close_on_lost` on, and the relays disarmed. Do not start it during business
start it during business hours without the user's word. Earlier versions are kept beside it as hours without the user's word. Earlier versions are kept beside it as
`zone_anpr.py.bak-20261122-*`. `zone_anpr.py.bak-20261122-*`.
- **Since 2026-11-23** the `zone_anpr.py` on park-lab also has the live picture of the H.264
test ([[zone-anpr-poc]]); the version before it is `zone_anpr.py.bak-20261123-prelive`. The
test runs as container `zg-h264`, which has no relay board configured, on the same port 8094,
so `zg2` and `zg-h264` cannot run together. The user left `zg-h264` running on 2026-11-23
(harmless: no relay armed or configured).
- **Records there:** `out/visits.jsonl`, `out/relays.jsonl`, `out/reads.jsonl`, - **Records there:** `out/visits.jsonl`, `out/relays.jsonl`, `out/reads.jsonl`,
`out/reads-all.jsonl`, and per visit `out/clips/<start>_<camera>/` with every processed frame, `out/reads-all.jsonl`, and per visit `out/clips/<start>_<camera>/` with every processed frame,
its box, and the kept stills with their reads. its box, and the kept stills with their reads.
+2 -2
View File
@@ -2,7 +2,7 @@
type: concept type: concept
tags: [parking, vision, anpr, passage, relay, poc, park-lab, review] tags: [parking, vision, anpr, passage, relay, poc, park-lab, review]
sources: [] sources: []
updated: 2026-11-22 updated: 2026-11-23
--- ---
# Zone ANPR PoC — code review (2026-11-21) # Zone ANPR PoC — code review (2026-11-21)
@@ -170,7 +170,7 @@ The PoC was changed three times on 2026-11-22 ([[zone-anpr-poc]], "The 2026-11-2
| 7–9 lane lock | open | | 7–9 lane lock | open |
| 10–12 liveness and timing | open, except that a close needs a frame under 1 s old | | 10–12 liveness and timing | open, except that a close needs a frame under 1 s old |
| 13 the still client dies for good | fixed: a new client for every still | | 13 the still client dies for good | fixed: a new client for every still |
| 14 the back-off carries over to the next car | open | | 14 the back-off carries over to the next car | open; seen live on 2026-11-23 (an 8 s pause from timeouts twenty minutes earlier) |
| 15 stills back to back with no cap | fixed: at most one every 0.5 s, capped while the car stands | | 15 stills back to back with no cap | fixed: at most one every 0.5 s, capped while the car stands |
| 16 cause of the still hangs | open; still seen, by day and by night | | 16 cause of the still hangs | open; still seen, by day and by night |
| One frame at the end decides the verdict (found by reading, not replayed then) | seen for real on 2026-11-22 night; fixed: a side counts after two looks | | One frame at the end decides the verdict (found by reading, not replayed then) | seen for real on 2026-11-22 night; fixed: a side counts after two looks |
+179 -1
View File
@@ -2,7 +2,7 @@
type: concept type: concept
tags: [parking, vision, anpr, passage, relay, poc, park-lab] tags: [parking, vision, anpr, passage, relay, poc, park-lab]
sources: [] sources: []
updated: 2026-11-22 updated: 2026-11-23
--- ---
# Zone ANPR PoC — field trials on park-lab # Zone ANPR PoC — field trials on park-lab
@@ -20,6 +20,11 @@ deferred to a later session, and the work list is on [[vision-hardening]].
off beforehand. The user's rule for now: *the barrier is operated only with the staff's remote off beforehand. The user's rule for now: *the barrier is operated only with the staff's remote
control; our system is not ready to control the barrier yet.* control; our system is not ready to control the barrier yet.*
**Back for one test (user, 2026-11-23):** a copy with **no relay board configured** (container
`zg-h264`) runs on H.264 sub-streams, to see what decoding costs. `zg2` stays stopped. See
"H.264 instead of MJPEG" below. **Left running (user, 2026-11-23):** in this state it is
harmless, no relay is armed or configured. The cameras' sub-streams stay on H.264 with it.
- **Seeing the car:** - **Seeing the car:**
- the **low-res MJPEG stream** (1280×720), about 5 frames a second through YOLOX-Tiny on the Intel - the **low-res MJPEG stream** (1280×720), about 5 frames a second through YOLOX-Tiny on the Intel
iGPU; iGPU;
@@ -362,6 +367,179 @@ it's open."*
as A → B and drive-outs as "other direction". The exit camera is not used for crossing as A → B and drive-outs as "other direction". The exit camera is not used for crossing
verdicts. Whether it still opens R1 or reads plates for drive-outs is not yet decided. verdicts. Whether it still opens R1 or reads plates for drive-outs is not yet decided.
## H.264 instead of MJPEG (2026-11-23)
**Why (user).** The server should hold no video or image work. MJPEG let it pass frames along
undecoded, which locks the system to cameras that offer MJPEG. A camera that streams only H.264
or H.265 has to be decoded somewhere, and that place is the vision side. The test: switch the
sub-streams to H.264, decode them in the PoC, show a live picture on its page, and watch the
booth PC's load.
**Set-up.**
- Container `zg-h264` on park-lab: the same image and code, `config-h264test.json`, records in
`out-h264test/`, page on port 8094. Its config names **no relay board** and it has no relay
password, so its arm button has nothing to send to. Restart policy `no`.
- The PoC gained a **live picture** for the page (`/live/<camera>.mjpg`): every decoded frame is
re-encoded as a JPEG once, for all viewers, and only while somebody watches. Before, the page
fetched a still every 700 ms. The metrics gained the codec, the network intake, the viewers and
the time from connecting to the first picture.
- Decoding is in software (FFmpeg inside OpenCV 4.13), RTSP over TCP, with FFmpeg's `nobuffer`
and `low_delay` set. The detector stays on the iGPU.
- **Camera change:** channel 102 on both cameras went from MJPEG to **H.264** (Main profile), with
a keyframe about every second (GOP 12 on the entry camera, 20 on the exit camera). Resolution,
frame rate and the 1024 kbps VBR cap were left as they were. The settings from before are saved
on park-lab as `~/zone-anpr-gpu/h264test/cam6-102-before.xml` and `cam7-102-before.xml`; a PUT
of those files puts MJPEG back.
**Measured** (21 ten-second windows each, empty lane, one viewer on each camera's live picture):
| | MJPEG | H.264 |
|---|---|---|
| Process CPU, of 6 cores | 0.40 | 0.41 |
| Host busy | 8.0% | 7.8% |
| Memory | 309 MB | 372 MB |
| Network intake | 15.2 Mbps | 1.85 Mbps |
| Frames in and decoded a second (entry + exit) | 12.5 + 20 | 12.5 + 20 |
| Live frames a second to the viewer | 12.5 + 20 | 12.5 + 20 |
| Detector, ms a look | 21 | 32 |
| First picture after connecting (entry, exit), one connect each | 1.8 s, 2.9 s | 3.6 s, 2.6 s |
- **The codec makes no difference to the CPU.** The network intake falls to an eighth.
- The earlier figure of 6–7% CPU was also taken with every MJPEG frame decoded (mode `stream`),
not only the frames looked at.
- Eight H.264 decode errors were logged in the second the exit stream first connected
(06:47:55 UTC), and none in the five minutes after. No stream loss after the switch.
- **The user, watching the page during the MJPEG run (2026-11-23):** "7%–8% CPU load. Not
bad." The user has not yet commented on the H.264 numbers.
**Delay from the camera to the live picture** (2026-11-23). Measured as on [[camera-live-view]]:
the camera's printed clock against the arrival of the live picture's JPEG, here at a viewer on
the booth PC itself, with each camera's clock bracketed over ISAPI to ±6–14 ms. 65–75 second
flips per camera; the minute flip agrees, so the figures are not off by whole seconds.
| | Entry (12.5 fps) | Exit (20 fps) |
|---|---|---|
| MJPEG straight from the camera (2026-11-17) | 0.09–0.10 s | 0.09–0.10 s |
| H.264, decoder on its default threads | 0.51–0.61 s | 0.39–0.43 s |
| H.264, **one decode thread** | 0.12–0.24 s | 0.18 s |
- **Cause of the first figure:** FFmpeg decodes H.264 on several threads by default, and each
extra thread holds one more frame back. On the 6-core booth PC that is 5 frames: 0.40 s at
12.5 fps, 0.25 s at 20 fps, which is the drop measured. The `low_delay` capture option did
not prevent it.
- **Fix in the PoC:** config key `decode_threads` (passed to OpenCV as `CAP_PROP_N_THREADS`);
the test copy runs with 1.
- With one decode thread and nobody watching the process used 0.27 cores and 328 MB, with no
decode error and the detector still at 5 looks a second.
- What is left, about 0.1 s over MJPEG, covers the camera's H.264 encoder, the decode and the
re-encode. A browser elsewhere adds its network and drawing time, which this does not include.
**The user's readings on the booth PC (2026-11-23, H.264, default decode threads):**
| | CPU | Download | Upload |
|---|---|---|---|
| Watching both pictures | 7–8% | 1.3 Mibps | 19.5 Mibps |
| Nobody watching | 5–6% | 1.1 Mibps | 400 Kibps |
Memory is steady either way. The upload is the live picture going to the browser as JPEGs
(about 107 KB a frame from the entry camera and 63–67 KB from the exit camera).
**A car in the zone** (2026-11-23, 07:32–07:33 UTC, AA927AU, H.264 with one decode thread; the
barrier was not driven, the relay lines are "would pulse" records). Read from the frames; the
user has not yet said what was driven.
| Start (UTC) | What the frames show | Verdict | Plate |
|---|---|---|---|
| 07:32:23 | drove up, stood 17 s short of the line, backed out | `abandoned`, would close | `AA927AU` decided after 0.34 s: 2 video frames and 1 still |
| 07:32:54 | drove up further, stood 4 s, backed out | `abandoned`, would close | undecided: `AA927AU` 2 votes, `HUIJE` 1 vote |
- **The flow judged both as the frames show them.** The followed car was matched in 5.0 looks a
second in both visits.
- **Video frames read the plate as well as before.** With the plate 65–90 px wide, 4 of 4 reads
were right and sure, the same as in the MJPEG day trial of 2026-11-22 (4 of 4). The sample is
small.
- **The camera's on-screen label was read as a plate.** In the second visit the car stood with
its bumper under the label "Hyrje" that the camera prints into the picture, and its own plate
was edge-on. 21 video frames and 3 stills then read the label (`HUIJE`, `HU1JE`, `HUIJB`), and
one still was sure enough (0.986) to vote. This is not an H.264 effect: 30 such reads are in
the records of 2026-11-20 to 22, none of them sure enough to vote until today. Now on
[[vision-hardening]]. The user moved both labels to the top-right corner the same day.
- **Load with the car in the zone:** 0.36–0.42 cores while it stood, and 0.84 cores (15% of the
host) for the ten seconds with 33 plate reads; memory rose from 329 to 512 MB and fell back to
441 MB. The detector kept 5 looks a second at 25–31 ms.
- **Two stills timed out** in the second visit (2 s and 4 s pauses), as on the earlier days. No
decode error and no stream loss.
**Staff traffic** (2026-11-23, 07:52–09:11 UTC, the same test copy). The user: the staff drove,
not the user. Nobody said what each vehicle did, so the column "What the frames show" is a
reading of the recorded frames, and these visits are not part of the scored set in
`recordings/`. The barrier was not driven: all 13 rows in `relays.jsonl` have `sent: false`.
| Start (UTC) | Camera | What the frames show | Seen | Verdict | Plate |
|---|---|---|---|---|---|
| 07:52:53 | entry | a dark car drives in without stopping | 0.6 s | `passed` | none: 1 video read at 52 px (weak), the one still timed out |
| 08:00:43 | exit | the same model of car, front to the camera, behind a blur that covers most of the picture | 0.4 s | `abandoned`, lost | undecided: `AB242TD`, 1 vote from a still (0.96); 3 video reads at 49–55 px |
| 08:28:36 | exit | a dark SUV moves out of sight behind a grey mass that fills the left half of the picture | 1.2 s | `abandoned`, lost | none: 3 stills, no plate found |
| 08:33:29 | entry | a black SUV stands 20 s short of the line, then five people push it through, rear first | 26.8 s | `passed` | none: 11 stills, no plate found; 4 stills timed out |
| 08:53:16 | entry | a white off-roader drives in without stopping | 2.2 s | `passed` | none: 2 video reads at 41–44 px (weak), 1 still read weak (0.61) with the plate at the crop's edge, 1 still timed out |
| 09:01:24 | exit | the white off-roader's rear at the edge of the grey mass | 0.2 s | `abandoned` | none |
| 09:09:44 | exit | a dark hatchback stands 62 s in the zone, then moves back, away from the camera | 63.3 s | `abandoned` | none: 91 video tries, 5 weak reads; 2 weak still reads |
| 09:11:04 | exit | not looked at | 0.6 s | `abandoned`, lost | none |
- **Bad weather (user, 2026-11-23).** The cameras are outdoors and the weather cannot be
fixed. The lane is wet in every clip of that morning. The soft plates and the blur in the exit
camera's picture have to be read with that in mind; how much of them is the weather was not
separated from the rest.
- **Entry camera: 3 of 3 `passed`,** which is what the frames show, and no close would have gone
out. The pushed car was followed for 27 s at 5 looks a second with five people around it.
- **Exit camera: not scored.** It is out for verdicts (see "The exit camera is
out"). Each of its five visits would have pulsed the open relay.
- **No plate was decided in eight visits. The records do not show that H.264 is the cause, and
they do not rule it out:**
- in the two drive-ins the plate was 41–52 px wide in the video frames at the moment the visit
started, under the 64 px gate, so those reads could not vote on MJPEG either (item 4 on
[[vision-hardening]]: the plate has to be read before the visit starts);
- on the MJPEG days (2026-11-21 and 22) the entry camera's video reads under 65 px were sure
(≥ 0.90) in 10 of 120; today in 3 of 17. At 65–90 px: 6 of 36 on MJPEG, 4 of 4 today, all
four from the user's own drive;
- the exit camera's five video reads at 82–88 px (09:10:46–47) scored 0.11–0.21. In those
frames the plate is too soft to read by eye. On the MJPEG days the exit camera's reads at
that width were sure in 2 of 7.
- The sample is too thin for a comparison. A drive with a known plate is still needed.
- **The blur and the grey mass in the exit camera's picture are not decoding faults.** The blur
of 08:00 is in the hi-res still as well, which does not come from the H.264 stream. What they
are was not established from the frames ([[vision-hardening]] records that the boom crosses
this camera's picture).
- **A vehicle's box reached the moved label, and it was not read.** The off-roader's box rose to
y = 37 of 720 at the right edge (08:53:19), with the label "Hyrje" inside it. No read of the
label is in the records of any of the eight visits.
- **Still timeouts on the entry camera:** 8 in 28 tries today (the user's drive included),
against 9 in 67 on 2026-11-22 by day. Cause not known. One on the exit camera.
- **The pause carried over to the next car** (finding 14 on [[zone-anpr-poc-review]], seen
live): the fail count is reset only by a still that succeeds, so the timeout at 07:52:54
drew an 8 s pause after the two of 07:32–07:33, twenty minutes earlier.
- **The stream held:** 12.5 and 20 frames a second in every ten-second window from 07:34 to
09:14 UTC, no decode error, no reconnect.
- **Load:** 0.27 cores with an empty lane; 0.77–0.90 cores (13–15% of the host) in the windows
with a standing vehicle being read. Memory went from 329 to 497 MB over the morning in steps,
one at each visit. The MJPEG run of 2026-11-22 did the same (296 MB after a start, 448–535 MB
after visits, peaks of 0.9–1.05 cores), so neither is an H.264 effect.
**Not measured.**
- Plate reading from H.264 frames at night, and by day with a known plate on a car that drives
through (the staff's drive-ins gave no usable comparison). The user (2026-11-23): this will be
handled as work of its own; it does not hold up moving the video work to the vision side
([[event-driven-refactor]]).
- Why the detector's time rose from 21 to about 30 ms a look. It still made its 5 looks a second
on both cameras in every run.
**Side effect, as long as 102 stays on H.264.** The parking server's booth camera tiles
([[camera-live-view]]) take MJPEG only (`packages/devices/src/drivers/rtsp-mjpeg.ts` refuses any
other codec), so they show no live video for these two cameras, on park-lab and on the dev
machine.
## Still open ## Still open
Deferred by the user on 2026-11-22. The work list, with the evidence for each item, is on Deferred by the user on 2026-11-22. The work list, with the evidence for each item, is on
@@ -0,0 +1,377 @@
---
type: decision
tags: [parking, decisions, auth, permissions, users, booth, core, multi-tenant, event-driven, sync]
sources: []
updated: 2026-11-23
status: open
---
# Users and permissions for the new booth — the model
The first piece of the [[event-driven-refactor]]: who may do what at a booth, in the structure
of the platform. **A model on paper. Nothing is built, and no language is assumed.**
Each part says whether it is **decided** by the user or **kept** from what runs today. The
single permission keys are proposed. What is left to the design of the sync is listed at the
end and is not put to the user again.
The platform's structure this follows (paths from the `EDA/` root):
`nats/wiki/decisions/adr-0002-auth-and-tenancy-model.md`,
`auth-service/wiki/concepts/data-model.md`, `auth-service/wiki/concepts/policies.md`,
`auth-service/wiki/concepts/login-security.md`,
`EDA/wiki/decisions/xadr-0002-permission-catalogue-registration.md`.
## Where identity lives (decided, user, 2026-11-23)
The user: "Everything should be in the platform. This, as leaf service, will sync everything
with the platform." And: "Everything is in constant sync. That is the purpose of the leaf
service. If there is no internet, who cares, the booth work will still flow."
- **The home of users, members, policies and the catalogue is the platform's auth service.**
Nothing about identity is defined at the booth only.
- **The booth holds a copy and is in constant sync with the platform, both ways.** That
includes password hashes. With no link the booth goes on working from its copy, and the two
sides catch up when the link returns.
- **Login at the booth is local.** It is checked against the booth's copy and needs no
connection to the platform. The session cookie is issued for the booth's own domain or IP
address. A session at the booth is not a session on the platform, or the reverse.
- **Users and policies can be changed at the booth or on the platform, at any time, by whoever
holds the right,** with a link or without.
- **A park's operators are created by whoever holds the right to create users,** at the booth
or on the platform.
## The people (decided, user, 2026-11-23)
Three kinds of people, all users of the platform:
| Who | What marks them | What they can do |
|---|---|---|
| Our staff | the platform admin flag | create tenants, set their access and subscriptions. **No access to the services** |
| The tenant admin | the tenant admin flag | the owner: counts as holding everything on the tenant's parks |
| The park's people | policies, and the parks assigned to them | what their policies allow, on those parks |
- **Login is by username; email is optional.** The platform is to take this.
- **A tenant admin can have many parks.** Scope `all` on the platform means every park of the
tenant; `assigned` means the parks assigned to the person.
- **A park is one site with one booth host.** No level is added between them until a park has
two hosts.
**Validation and the car wash are out of the booth (decided, user, 2026-11-23).** They are to
be separate services, each with its own set of permissions. The booth's catalogue holds no key
of theirs, and the jobs Merchant and Wash operator are removed. They will connect to each other
and to parking as business to business. **Postponed by the user, who asked not to be asked
about them again:** separate services are built if need be, for a car wash, hotels, cafés and
the like. Nothing about them is designed or raised here until the user brings it up.
## What runs today, and what of it is kept
Today's scheme is on [[local-jwt-auth]] and [[venue-modules]] ("Permissions matrix"). It grew by
additions, and the user calls the result sloppy. Parts of it were deliberate decisions and are
kept.
**Kept:**
- **A login lasts until logout** (decided 2026-06-15): a relief who arrives late, or a forced
double shift, must not be logged out mid-duty. A [[shift]] is the accountability boundary, not
the login.
- **Guards check a permission, never a role name.**
- **One admin that can never be locked out:** it always holds everything, and the last one
cannot be removed or demoted.
- **No grant beyond your own:** a user can give, edit or reset only what lies within their own
permissions.
- **Jobs are code, grants are data, and a software update never widens a grant by itself**
(user, 2026-09-06): a job that grew in a release is re-applied by an admin's click.
- **Each desk's money is guarded by that desk's own permissions** (2026-09-05). The booth till
is guarded by parking's keys only; another service's till is that service's matter.
- **The live feed is filtered by permission,** and is not the reports screen (user, 2026-09-05).
- **Grant edits are signed** on the ledger.
- Soft delete of users and grants ([[soft-delete]]); one generic "invalid credentials" answer; a
user changes their own password only by proving the current one; the module gate before the
permission ([[venue-modules]]); money routes need an open shift.
**Scope in the permission string (decided, user, 2026-11-23).** On 2026-09-05 scoped strings
were rejected (`shift:create@carwash`, [[venue-modules]] "Permissions matrix"); the scope then
was the desk. The user now takes them with the scope meaning ownership (`all` or `assigned`),
in the form the platform's sessions and policies carry, `key@scope`. It is used on one key,
`parking.shift:read`.
The second rejection of that day, a copy of the shift and drawer resources per module, no
longer arises here: with the car wash out of the booth, the booth has one till.
**What the code shows as wrong** (`packages/shared/src/index.ts`, `apps/server/src/routes/`):
- **A verb standing in for ownership:** `shift:cash` means "sees every operator's shifts".
- **A catch-all:** `site:update` guards site settings, device setup, the discount programs and
the car-wash settings.
- **Names that hide what they grant:** `barrier:create` is the forgiven exit, `session:create`
the operator-issued ticket, `event:void` the ticket void.
- **Writes behind a read:** arming a card capture and printing a subscription card need only
`subscription:read`.
- **Keys that no guard checks:** `payment:read` and `validation:read` appear only in job presets.
- **Cross-cutting keys with no owner:** `event:read`, `drawer:review` and `shift:cash` cover every
desk at once.
- **One role per user,** with bindings outside the grid (a merchant's programs, the till guards).
- **Module permissions sit in the one shared list.**
- **User changes are not signed:** `apps/server/src/routes/users.ts` appends nothing to the
ledger; role edits do.
- **The login token cannot be revoked by itself:** the guard re-reads the user's role on every
request to make up for it.
## The model
| Platform | Booth today | New |
|---|---|---|
| User: global, email, argon2id | `users`: username, bcrypt, one `role_id` | **The platform's user,** with a username (email optional), copied to the booth with its argon2id hash and its disabled flag |
| Membership (user, tenant) with a `tenant_admin` shortcut | the built-in `admin` role | **The platform's member.** The admin flag is the shortcut: every permission of every enabled product at scope `all` |
| Policy: named, allow-only list of (permission, scope) | `roles` + `role_permissions` | **The platform's policy,** copied to the booth. A policy remembers the jobs it was composed from, as roles do today |
| Several policies per member; the union counts | one role per user | **Several policies per member;** the union counts, `all` beats `assigned` |
| Catalogue per product, `<product>.<resource>:<action>`, each key declaring its scopes | one list, `resource:action` | **The platform's `auth` catalogue, and a `parking` catalogue registered on the platform** as `gps` is |
| Session: opaque id, revocable, permissions computed in | a token with no expiry | **A local session:** an opaque id in the booth's database, its cookie for the booth's domain or IP. No expiry by time (kept). Ended by logout, a password change, disabling the user, or an admin |
| Entitlement per tenant and product | `MODULES_ENTITLED` and the site's activation | **The platform's entitlement,** copied to the booth |
- **Preferences** (language, theme, font size, open camera tiles) stay per user and are not part
of identity.
## The catalogue
**Two product keys, `auth` and `parking` (decided, user, 2026-11-23).** A product key is the
short name of a product a tenant is given on the platform, as `auth`, `fleet` and `gps` are
there. Users and grants are one concern and parking is another
([[event-driven-refactor]], Rule 1 of the guideline):
- **`auth`: users, members and policies.** The platform's catalogue
(`auth-service/src/permissions/auth-permissions.ts`), always on.
- **`parking`: everything else at the booth,** in the form `parking.payment:take`. That
includes the product's own settings, devices, backup, logs, recycle bin, reports and ledger,
as `gps.settings:*` and `gps.device:*` sit under `gps`.
**`auth.user:manage` is not in the platform's catalogue today.** The platform left it out on
purpose: only our staff create users there. With "whoever holds the right" it is needed on the
platform, where everything lives. That is a change in the platform, not made from this session.
The platform's `auth.tenant:read` and `auth.branding:manage` guard nothing at the booth.
**Scope `assigned`** is used on one booth key, `parking.shift:read`, where it means one's own
shifts. On the platform's side it means the parks assigned to a person.
The single keys below are proposed.
| Key | Scopes | Grants |
|---|---|---|
| `auth.user:read` | all | see the user accounts |
| `auth.user:manage` | all | create, change, disable, delete a user; reset a password |
| `auth.member:read` | all | see the members and the policies each holds |
| `auth.member:manage` | all | attach and detach policies; set the admin flag |
| `auth.policy:read` | all | see policies |
| `auth.policy:manage` | all | create, change, delete policies |
| `parking.settings:read` | all | see the site's settings and version |
| `parking.settings:manage` | all | change the site's settings, including the presence bypass |
| `parking.device:read` | all | device and printer status, the device part of the live feed, camera live tiles |
| `parking.device:manage` | all | Setup: discover, assign, test a relay, a printer, a camera |
| `parking.log:read` | all | the diagnostic log |
| `parking.recyclebin:read` | all | see deleted master data |
| `parking.recyclebin:restore` | all | restore it |
| `parking.recyclebin:purge` | all | remove it for good |
| `parking.backup:read` | all | backup status |
| `parking.backup:manage` | all | backup target and schedule |
| `parking.backup:run` | all | back up now |
| `parking.ledger:read` | all | every event of the signed ledger: the log, the live feed, the chain check |
| `parking.report:read` | all | the reports screen |
| `parking.session:read` | all | active sessions, lookup, quote, snapshots, occupancy |
| `parking.ticket:issue` | all | issue an entry ticket from the booth ([[operator-issued-entry]]) |
| `parking.ticket:void` | all | void a ticket (an appended event) |
| `parking.payment:take` | all | take a payment, print a voucher or receipt, open the exit, re-open the barrier |
| `parking.exit:forgive` | all | open the exit with no payment ([[forgiven-exit]]) |
| `parking.tariff:read` | all | read and simulate the tariff |
| `parking.tariff:manage` | all | drafts and new versions |
| `parking.subscription:read` | all | the subscription registry, a price quote |
| `parking.subscription:sell` | all | sell one: capture a card, print it |
| `parking.subscription:update` | all | change or revoke one |
| `parking.subscription:delete` | all | delete one |
| `parking.plan:manage` | all | compose the plan catalogue; move a sold subscription to another plan version |
| `parking.discount:read` | all | see the discount programs (a program is a parking discount; applying one is the validation service's act) |
| `parking.discount:manage` | all | compose the discount programs |
| `parking.shift:read` | assigned, all | `assigned` = own shifts and their cash movements; `all` = every operator's |
| `parking.shift:work` | all | open and close one's own booth shift |
| `parking.drawer:record` | all | record cash in and out on one's own shift |
| `parking.drawer:review` | all | authorize or deny a recorded movement |
Verbs other than read, create, update, delete and manage are used where the act is not a plain
edit (`take`, `issue`, `void`, `forgive`, `sell`, `work`, `record`, `review`, `run`, `restore`,
`purge`), as the platform does with `gps.device:release`.
## Every permission of today, mapped
All 44 entries of `PERMISSIONS`, each once. "Guards today" is what the code checks with it.
"Leaves" means the permission goes with the validation or the car-wash service and has no key
at the booth.
| Today | Guards today | New |
|---|---|---|
| `user:create` | create a user, with its role | `auth.user:manage`, `auth.member:manage` |
| `user:read` | list users, with their role | `auth.user:read`, `auth.member:read` |
| `user:update` | change a user and its role, reset a password | `auth.user:manage`, `auth.member:manage` |
| `user:delete` | delete a user | `auth.user:manage` |
| `role:create` | create a role | `auth.policy:manage` |
| `role:read` | list roles | `auth.policy:read` |
| `role:update` | change a role | `auth.policy:manage` |
| `role:delete` | delete a role | `auth.policy:manage` |
| `tariff:read` | read, simulate, list drafts | `parking.tariff:read` |
| `tariff:update` | drafts, new versions | `parking.tariff:manage` |
| `subscription:read` | the registry, plans and a quote; also arm and cancel a capture, print a card | `parking.subscription:read`; the capture and the print move to `parking.subscription:sell` |
| `subscription:create` | sell | `parking.subscription:sell` |
| `subscription:update` | change, revoke | `parking.subscription:update` |
| `subscription:delete` | delete | `parking.subscription:delete` |
| `subscription:plan` | compose, retire, reactivate, delete plans; move a sold subscription to another plan version | `parking.plan:manage` |
| `site:read` | site settings, version, occupancy, discount programs, car-wash settings | `parking.settings:read`; occupancy to `parking.session:read`; programs to `parking.discount:read`; the wash settings leave |
| `site:update` | site settings, presence bypass, all of Setup, discount programs, car-wash settings | `parking.settings:manage`, `parking.device:manage`, `parking.discount:manage`; the wash settings leave |
| `validation:create` | apply a discount, see and void one's own | leaves (validation) |
| `validation:read` | nothing; in the supervisor job only | leaves (validation); no guard uses it today |
| `device:read` | device and printer status, camera alarms, camera live tiles, the device part of the feed | `parking.device:read` |
| `shift:read` | read the booth till (through the till guard) | `parking.shift:read@assigned` |
| `shift:create` | open and close the booth shift (till guard) | `parking.shift:work` |
| `shift:cash` | see every operator's shifts, on every till | `parking.shift:read@all`; the wash till leaves |
| `drawer:create` | record booth cash in and out (till guard) | `parking.drawer:record` |
| `drawer:review` | review movements, on every till | `parking.drawer:review`; the wash till leaves |
| `payment:read` | nothing; in the two booth jobs only | dropped |
| `payment:create` | pay, voucher, receipt, exit, re-open | `parking.payment:take` |
| `session:read` | active sessions, lookup, quote, snapshots, the occupancy part of the feed | `parking.session:read` |
| `session:create` | issue an entry ticket | `parking.ticket:issue` |
| `event:read` | every event type in the log and the live feed, and the chain check; a role without it sees only the events of a module whose feed permission it holds | `parking.ledger:read` |
| `event:void` | void a ticket | `parking.ticket:void` |
| `report:read` | the reports screen | `parking.report:read` |
| `log:read` | the diagnostic log | `parking.log:read` |
| `recyclebin:read` | list | `parking.recyclebin:read` |
| `recyclebin:update` | restore | `parking.recyclebin:restore` |
| `recyclebin:delete` | purge | `parking.recyclebin:purge` |
| `backup:read` | status | `parking.backup:read` |
| `backup:update` | target, schedule, test | `parking.backup:manage` |
| `backup:create` | back up now | `parking.backup:run` |
| `carwash:read` | queue, lookup, wash settings, the wash till's state, the wash's events | leaves (car wash) |
| `carwash:create` | take in an order | leaves (car wash) |
| `carwash:update` | done, bay payment, void | leaves (car wash) |
| `carwash:cash` | open and close the wash shift, wash cash in and out (till guard) | leaves (car wash) |
| `barrier:create` | the forgiven exit | `parking.exit:forgive` |
Routes that need a login and no permission stay so: one's own profile, preferences and
password, and the list of tills one may read. `GET /api/setup/catalog` has no guard at all
today (driver schemas, no secrets).
## Jobs (kept, re-expressed)
A job is a bundle declared in code, offered as one click when composing a policy, and
remembered by the policy. The booth has two. Merchant and Wash operator are removed (user,
2026-11-23).
| Job | Contains |
|---|---|
| Booth operator | `parking.session:read`, `parking.ticket:issue`, `parking.payment:take`, `parking.ledger:read`, `parking.shift:read@assigned`, `parking.shift:work`, `parking.drawer:record`, `parking.device:read` |
| Booth supervisor | the operator's, with `parking.shift:read@all` in place of `@assigned`, plus `parking.ticket:void`, `parking.drawer:review`, `parking.report:read`, `parking.subscription:read`, `:sell`, `:update`, `parking.tariff:read` |
## Rules
Kept from today, in the new terms:
1. A guard names a permission; the admin flag passes every guard of an entitled product.
2. The last admin cannot be deleted or have the flag removed.
3. No grant beyond your own: for policies you write, policies you attach, and users you change.
4. The module gate comes first: a product that is not entitled or not activated answers "not
available", whatever the member holds.
5. A deleted user cannot log in, and their sessions end at once.
6. A policy or attachment change applies at once, with no new login.
7. A job is never applied by the software; a policy that is behind its job is shown as such.
New, as on the platform:
8. A user can be disabled without being deleted; a disabled user is treated as a deleted one in
rules 2 and 5.
9. A user cannot change the policies they hold themselves.
10. A password change ends the user's other sessions.
11. Unknown user, wrong password and disabled all answer the same.
11a. **A password has at least 12 characters** (decided, user, 2026-11-23), as on the platform;
the booth asks for 8 today.
12. **No account is ever locked for wrong passwords** (decided, user, 2026-11-23). At a booth
every login comes from one screen, so a lock would let anyone shut the admin out by typing
the admin's name. Proposed with it: each wrong try for a username makes the next one wait
longer (1 s, 2 s, 4 s, up to about 30 s), which slows guessing and locks nobody out.
## The ledger and signing (decided, user, 2026-11-23)
- **The booth is the only writer of its ledger.** The platform syncs, reads and monitors it.
- **A booth is recovered from the platform.** Users and policies come back by the sync, the
ledger from the platform's copy.
- **Entries are signed with a key pair, on the P-256 curve,** which the hardware signers
considered for the booth use ([[hardware-signer-options]], [[open-questions]] #6). Never a
secret shared by two sides, which is what today's signer is (`apps/server/src/signer.ts`):
whoever holds a copy can write any ledger.
- **The booth's private key never leaves the booth.** A rebuilt booth starts a new key; the
platform holds the public keys and records the change.
What follows for users and grants: a change that the booth applies is an entry in its ledger,
whether it was made at the booth or arrived by the sync. Today only role edits are signed
(`apps/server/src/routes/users.ts` appends nothing). A new user or a wider grant then leaves a
trace that no admin can remove.
## Earlier rulings of 2026-11-23 and what became of them
Made during the day, before "everything in the platform, in constant sync".
| Ruling | Now |
|---|---|
| Accounts of a park live on the booth only; no account is shared between the three rings | **Replaced.** All are platform users; the booth holds a copy |
| Password hashes stay on the booth | **Replaced.** Everything syncs |
| A change from the core is a command signed with the core's key, naming the person | **Replaced** by the sync |
| No command is issued while the booth is offline; the core disables the buttons | **Replaced.** A change made on the platform while a booth is offline reaches it when the link returns |
| The platform changes nothing at a booth but users and grants | **Stands.** The platform does not operate a park: no money, no barrier, no tariff |
| The first password is a one-time code, replaced at the first login, valid 24 hours from issue | **Stands** |
| "No grant beyond your own" holds for the tenant admin, who counts as holding everything on their parks | **Stands** |
| No account is locked for wrong passwords | **Stands** (rule 12) |
| A forgotten admin password with the link down: bring the link up through a phone's hotspot, or wait | **Stands,** and anyone at the booth who holds `auth.user:manage` can reset it there |
| A password has at least 12 characters | **Stands** (rule 11a) |
| P-256 for ledger entries | **Stands** |
## What the platform needs for this
For the platform wiki, which is not written from this session:
| Today on the platform | Needed |
|---|---|
| Users are identified by email | login by username, email optional (user) |
| Only platform staff create users; `auth.user:manage` is not in the catalogue | a tenant's person who holds the right creates users (user: "whoever has the right to do so") |
| A service keeps no users and no login | a leaf holds a copy of its park's users, members, policies and password hashes, and logs people in locally |
| Identity is changed in the auth service only | changes made at a leaf are taken in by the sync |
| No `parking` catalogue | the `parking` catalogue registered, so the policy editor offers its keys |
Where the booth still behaves differently, by the user's decisions:
| Platform | Booth | Decided |
|---|---|---|
| A session expires after 12 hours, renewed by use | no expiry by time | 2026-06-15 |
| An account is locked for 15 minutes after 5 wrong passwords | no lock | 2026-11-23 |
| Built-in policies are regenerated from the catalogue at every start | a software update never widens a grant by itself; jobs are applied by an admin's click | 2026-09-06 |
## Left to the design of the sync
Technical points, with the default that will be taken. They are not put to the user again
unless one of them turns out to change how a park works.
1. **The same user or policy changed in two places while the link was down.** Default: the
later change wins, and both stay in the history.
2. **The same username created in two places while the link was down.** Default: ids are
minted where the user is created and never clash; the later username is refused at sync
and shown to an admin.
3. **Which people are copied to which booth.** Default: the members assigned to that park, and
the tenant admins.
4. **Tenant id and site id** come from the platform when a booth is enrolled.
5. **Entitlements** are copied like the rest; a booth with no link keeps the last copy.
6. **Built-in policies.** The platform generates `parking-admin`, `-operator` and `-viewer` as
for every product. Default: they exist as on the platform, and the two jobs stay as presets
for custom policies.
7. **The wait between wrong password tries** (1 s, 2 s, 4 s, up to about 30 s), proposed with
rule 12.
8. **One key for a user.** Creating, changing and deleting a user are one key
(`auth.user:manage`); today they are three.
9. **The operator's live feed.** `parking.ledger:read` shows every event, as `event:read` does
today.
10. **The running parks** are out of the refactor for now. When they move, each of today's
roles becomes a policy by the mapping above, and passwords shorter than 12 characters
exist there.
+11 -1
View File
@@ -2,7 +2,7 @@
type: decision type: decision
tags: [parking, camera, ui, booth, video, hikvision] tags: [parking, camera, ui, booth, video, hikvision]
sources: [] sources: []
updated: 2026-11-17 updated: 2026-11-23
status: settled status: settled
--- ---
@@ -13,6 +13,10 @@ footer]] and watch that camera live while a vehicle is in front of it. **BUILT 2
verified end to end against the two park-lab cameras through the real server and in a browser verified end to end against the two park-lab cameras through the real server and in a browser
(not yet in the [[desktop-shell-tauri|desktop shell]] — see *Not yet verified*). (not yet in the [[desktop-shell-tauri|desktop shell]] — see *Not yet verified*).
> **2026-11-23:** the user decided that the server holds no video or image work
> ([[event-driven-refactor]]). The live picture is to come from the vision side; how the booth
> screen gets it is not decided. This page describes what is built and running.
## What the user asked for (2026-11-17) ## What the user asked for (2026-11-17)
- The camera chips in the footer are clickable; a click opens that camera's tile in the bottom - The camera chips in the footer are clickable; a click opens that camera's tile in the bottom
@@ -114,6 +118,12 @@ agreement.
`camera-activity` on `/api/ws`; two viewers on the entry camera and one on the exit camera went `camera-activity` on `/api/ws`; two viewers on the entry camera and one on the exit camera went
`connecting → live` in 151 / 181 ms, 8–10 fps each, zero malformed JPEGs. `connecting → live` in 151 / 181 ms, 8–10 fps each, zero malformed JPEGs.
> **2026-11-23:** channel 102 on both park-lab cameras is on **H.264** for a decoding test
> ([[zone-anpr-poc]], "H.264 instead of MJPEG"). The tiles take MJPEG only, so they show no
> live video for these cameras until 102 is put back or the live picture moves to the vision
> side ([[passage-confirmation]], "Where the video work lives").
## Install step (new) ## Install step (new)
Set the camera's **sub-stream (102) video encoding to MJPEG** (web UI: Configuration → Video/Audio Set the camera's **sub-stream (102) video encoding to MJPEG** (web UI: Configuration → Video/Audio
+9 -1
View File
@@ -2,7 +2,7 @@
type: decision type: decision
tags: [parking, decision, devices, transport] tags: [parking, decision, devices, transport]
sources: [] sources: []
updated: 2026-06-15 updated: 2026-11-23
status: settled status: settled
--- ---
@@ -44,3 +44,11 @@ If the system grows to **many lanes / many controllers**, or multiple subsystems
signage) all need to share events, a broker becomes a worthwhile central event bus. That aligns signage) all need to share events, a broker becomes a worthwhile central event bus. That aligns
with the [[autonomous-direction|unmanned]] roadmap at multi-lane scale — re-evaluate then. Until with the [[autonomous-direction|unmanned]] roadmap at multi-lane scale — re-evaluate then. Until
then, direct HTTP/UDP wins on simplicity and reliability. then, direct HTTP/UDP wins on simplicity and reliability.
## The condition is met (2026-11-23)
The user decided a bus between the vision side, the server and the booth screen, as part of an
event-driven refactor of the repository ([[event-driven-refactor]]). That is the case named
above: several subsystems sharing events. Which bus is not decided, and nothing here says the
relay controller moves onto it. The objections above (new infrastructure on the appliance, one
more thing on the path that opens the barrier) still want an answer in that plan.
+275
View File
@@ -0,0 +1,275 @@
---
type: decision
tags: [parking, decisions, architecture, event-driven, vision, camera, bus, refactor]
sources: []
updated: 2026-11-23
status: open
---
# Event-driven refactor of the repository
**Decided by the user on 2026-11-23: this repository is to be refactored as a whole, following an
event-driven pattern.** The user's guidelines document arrived the same day:
`EDA/wiki/guideline-joining-the-platform.md` (the platform wiki, not this vault). The user's
instructions on what to do with it have not been given. **Nothing is designed or built.** This
page holds what is decided, what is not, what the decisions touch in the code as it stands, and
how the guideline reads against this repository.
How it came up: the discussion on bringing the ideas of the [[zone-anpr-poc]] into the product
([[passage-confirmation]]), and the H.264 decoding test of the same day.
## Decided (user, 2026-11-23)
1. **The repository is refactored as a whole, event-driven.** The shape comes from the user's
guidelines.
2. **A bus connects the vision side, the server and the booth screen.** Its details settle with
the guidelines.
3. **The server holds no video or image work.** Using MJPEG locked the system to cameras that
offer it; another vendor's stream has to be decoded into a usable form, and the server is not
the place for that. The vision side talks to the cameras, decodes whatever they send, and
produces what the rest needs.
4. **The server is agnostic about the camera side.** A signal from a camera is one way in among
several. If it comes, good. If it does not, an RF card, a barcode or a push-button ticket does
the job. The user's examples: a car with no plate at all; a leaf, a piece of cardboard or a
plastic bag in front of the lens; a camera that dies. The server does nothing special in any
of them. Where a missing camera or radar signal blocks a ticket, the admin bypass unblocks it
([[entry-presence-bypass]]). The monitoring already in place shows that a service or a device is down
([[device-status-monitoring]]), and the operator raises the issue.
5. **Services that die together are an accepted concession,** and a watchdog service takes care
of crashed services. Not designed.
6. **Plate reading from H.264 frames is work to be done,** and does not hold up this direction.
The morning's records neither blame nor clear H.264 ([[zone-anpr-poc]], "Staff traffic").
7. **Watching the live picture from outside the booth's network is out of scope for now.**
## Not decided
- **Whether the parking system joins the platform as a leaf under the guideline.** The guideline
names the bus for any service that joins: NATS JetStream, on a site through the leaf stack of
the nats repo. It also lists "Parking as the first leaf product" under its own "Not decided"
(`EDA/wiki/queries/q-parking-core-service-on-the-platform.md`, deferred by the user on
2026-10-20). See "The guideline against this repository" below.
- The events: their names, their contents, who publishes and who consumes.
- How the booth screen gets the live picture, and how the vision side gets the camera logins.
Both were left to this refactor.
- The watchdog.
- The order of the work, and what happens to the features that are built.
## What the decisions touch in today's code
| Today | Where |
|---|---|
| The server holds the live view: an RTSP client that takes MJPEG only, and a hub that serves the booth tiles | `apps/server/src/camera-live.ts`, `packages/devices/src/drivers/rtsp-mjpeg.ts`, `packages/devices/src/drivers/rfc2435.ts` ([[camera-live-view]]) |
| The server pulls stills from the cameras, re-encodes them and reads their size | `apps/server/src/snapshot.ts`, `packages/devices/src/drivers/camera.ts` |
| The plate bridge: on a camera's push the server pulls a still and posts it to the vision service | `apps/server/src/anpr-entry.ts`, `apps/server/src/vision-client.ts`, `apps/server/src/routes/hikvision-alarm.ts` ([[lane-presence-and-anpr-entry]]) |
| The vision service is stateless: it is handed pictures and never talks to a camera | `apps/vision/` ([[vision-service]], [[vision-service-packaging]]) |
| The server cuts and blurs the car-wash review picture | `apps/server/src/modules/carwash/review-outbox.ts` ([[vision-review-outbox]]) |
| The server stores and serves the evidence pictures of ledger events | `apps/server/src/routes/snapshots.ts` |
| Monitoring: the server probes each camera for reachability and the vision service's `/health`, and shows both in the booth footer | `apps/server/src/device-monitor.ts` ([[device-status-monitoring]]) |
The zone flow, the relay rules and the plate consensus exist only in the prototype
(`poc/zone-anpr/`), with their checks and recorded visits ([[vision-hardening]], "What carries
over").
## Where the decisions meet what is built
1. **The camera gates the entry button today. Settled (user, 2026-11-23): it stays, and the
bypass is the answer.** With an entry camera configured, a press on the button prints a
ticket only while that camera reports a vehicle (`apps/server/src/entry-flow.ts`,
[[entry-double-press]]), and the operator-issued entry needs the radar and the camera
([[operator-issued-entry]]). A camera that is dead or blinded stops the button ticket until
an admin sets the bypass ([[entry-presence-bypass]]). The user: that unblocking mechanism for
camera and radar events is in place.
- The signal behind that gate is the camera's own vehicle detection, pushed to the server
(`apps/server/src/routes/hikvision-alarm.ts`), not the vision service.
2. **A blinded camera shows as healthy. Settled (user, 2026-11-23): not the system's concern.**
The monitoring probes whether a camera answers, not whether it sees. A camera that is healthy
but blinded is an operational matter of the business.
3. **A broker was skipped on purpose in 2026-06 (open)** ([[dingtian-vs-mqtt]]): new infrastructure on
a single-purpose appliance, and one more thing on the path that opens the barrier. That page
named its own condition for looking again, several subsystems sharing events, and it is now
met. Its objections still want an answer in the plan.
4. **Evidence pictures (open).** A snapshot is written before the barrier pulse and attached to the
signed entry ([[standing-decisions]], "Bounded request cost"; [[append-only-event-chain]]).
Who takes it and who keeps it once the server holds no image work is open.
5. **[[vision-service]], decision 3,** has the Node backend call the vision service over
localhost HTTP with pictures the camera driver pulled. The refactor replaces that.
6. **The repository's `CLAUDE.md`** still describes the server as the home of the device
drivers. Left as it is until the guidelines arrive.
## Scope, and the language (user, 2026-11-23)
Stated by the user after reading the guideline's collisions:
- **A multi-tenant core server handles all future parks.** The core only shows records, and
only those a booth has synced to it.
- **The parks already running (park-buzi, park-2) stay out of this refactor for now.** Later it
must be possible to migrate them into the new architecture.
- **The park is offline-first.** The leaf lives with no internet connection and without the core
infrastructure.
- **The guideline binds the leaf only for the structure of users and permissions.** That was
said while Rust was on the table; with TypeScript and Docker chosen, the guideline's
technology table is the nearest standard for `apps/booth` and `apps/core`.
**Where it is built (user, 2026-11-23):** in this repository, on its own branch `eda_dev`, in
parallel to the existing code. New directories stand beside the
existing ones, named for what they are: **`apps/booth`** (the site) and **`apps/core`** (the
multi-tenant core), agreed by the user in place of the first examples `apps/web_new` and
`apps/server_new`. The existing apps keep serving the running parks from `dev` → `stage` →
`main`.
- `eda_dev` was cut from `stage` on 2026-11-23, which was 80 commits ahead of `dev` and had
nothing behind it.
- The build and deploy workflows run on `dev`, `stage` and `main` only, and the Komodo stacks
are pinned to `stage` tags, so a push of `eda_dev` builds and deploys nothing
(`.gitea/workflows/`, `komodo/resources.toml`).
- `pnpm-workspace.yaml` takes every directory under `apps/` and `packages/`, so a new directory
with a `package.json` joins the workspace and the Turbo tasks on that branch.
**The language is TypeScript, delivered with Docker (decided, user, 2026-11-23): "I abandoned
the idea of Rust."** Earlier the same day the user had asked whether to remove Docker from the
leaf and rebuild every service in Rust, because the booth relies on a lot of RAM and SSD
today. The measurements below were taken for that question and stay as a record.
**Measured on park-lab the same day** (7.2 GB RAM, 5.0 GB available; 231 GB disk, 23 GB used):
| | Memory | Disk |
|---|---|---|
| Server (Node) | 87 MB | image 378 MB |
| Vision service (Python) | 425 MB | image 1.95 GB |
| Proxy (Caddy) | 11 MB | image 92 MB |
| Docker itself (dockerd, containerd, shims, proxy) | about 230 MB | build cache 4.5 GB |
| Komodo Periphery | 23 MB | |
| The zone PoC, for comparison | 401 MB | image 3.37 GB |
- The memory sits in the vision side (model runtime and frames), not in the Node server.
- The disk incident at park-2 was backups and snapshots, not images ([[park-2-disk-growth]]).
- Size of what a rewrite covers: about 26,000 lines of TypeScript behind the API (server,
device drivers, database, shared) with about 11,000 lines of tests; 19,000 lines of web app
that could stay if the API is kept; about 1,000 lines of Python in the vision service.
**What staying with Docker keeps:** deployment and remote control on Komodo, which drives
compose stacks ([[fleet-deployment-komodo]], [[container-deployment]]), and the platform's leaf,
which is delivered as a compose stack (`nats/compose.leaf.yaml`).
## Users and permissions, the first piece (2026-11-23)
The user asked where to start; users and permissions is the candidate, as a model on paper
before any code. The old permissions are, in the user's words, sloppy work. What the code shows:
verbs standing in for scope (`shift:cash`, `drawer:review`, `subscription:plan`,
`carwash:cash`), a catch-all (`site:update`), names that hide what they grant (`barrier:create`,
`session:create`), one role per user with extra bindings outside the grid, module permissions in
the one shared list (`packages/shared/src/index.ts`), a login token with no expiry
(`apps/server/src/auth.ts`).
**Decided by the user (2026-11-23); the detail is on [[booth-users-and-permissions]]:**
- **Everything about identity is in the platform, and the booth is in constant sync with it,
both ways.** Users, members, policies and the catalogue have their home in the platform's
auth service; the booth holds a copy, password hashes included. With no link the booth goes
on working and catches up later.
- **Login at the booth is local,** against the copy, with a session cookie for the booth's own
domain or IP address.
- **Users and policies can be changed at the booth or on the platform, at any time, by whoever
holds the right.** The same holds for creating a park's operators.
- **Login is by username; email is optional.** The platform is to take this (a change in the
platform, not made from here).
- **Three kinds of people, all platform users:** our staff (tenants, access, subscriptions; no
access to the services), the tenant admin (the owner; holds everything on the tenant's parks;
can have many parks), the park's people (policies, and the parks assigned to them).
- **A park is one site with one booth host;** no level between them until a park has two hosts.
- **The booth is the only writer of its ledger.** The platform syncs, reads and monitors, and a
booth is recovered from it. Entries are signed with a key pair on P-256.
- **Two product keys:** `auth` for users, members and policies (the platform's catalogue,
always on); `parking` for everything else, registered on the platform, in the form
`parking.payment:take`.
- **Scope in the permission string** (`parking.shift:read@assigned`, `@all`), **a password of
at least 12 characters, no lock for wrong passwords,** a first password given as a one-time
code valid 24 hours.
- **Validation and the car wash are not part of the booth.** They will connect to each other
and to parking as business to business. Postponed: the user asked not to be asked about them
again; separate services are built if need be (car wash, hotels, cafés).
Earlier the same day the accounts of a park were placed on the booth only ("three rings"), with
signed commands from the core. That was replaced by the first point above; the model page
lists each earlier ruling and what became of it, what the platform needs for this, and the
technical points left to the design of the sync.
The platform's structure this is mapped onto: `nats/wiki/decisions/adr-0002-auth-and-tenancy-model.md`,
`auth-service/wiki/concepts/policies.md`, `auth-service/wiki/concepts/data-model.md`,
`EDA/wiki/decisions/xadr-0002-permission-catalogue-registration.md` (paths from the `EDA/` root).
## The guideline against this repository (2026-11-23)
Source: `EDA/wiki/guideline-joining-the-platform.md`. A reading, with nothing designed from it.
**Whose rule is what, as the guideline itself says:**
- **Rule 1, one concern, one service,** is the user's. A system that arrives with its own
login, its own administration screens and its own cloud back end in one deployable is split
first.
- **Rule 2, the site carries only what must be on the site,** is the platform architect's
reading, not yet confirmed by the user. So is the rule that unproven leaf mechanics are proven
on the lab box first.
- **Its "Not decided" list** holds three things this refactor runs into: parking as the first
leaf product; a local operator login while the link is down; a standard for a service with no
HTTP API, which is what a vision service that talks to cameras would be.
**Rule 1, row by row, against what this repository does today:**
| Concern | Owner on the platform | In this repository today |
|---|---|---|
| Users, login, sessions | auth-service | its own: tables `users`, `roles`, `sessions` (`packages/db/src/schema.ts`), `apps/server/src/routes/auth.ts`, `@fastify/jwt` ([[local-jwt-auth]]) |
| Which tenant may use which product | auth-service | its own flags: `MODULES_ENTITLED` and the site's activation (`apps/server/src/modules.ts`, [[venue-modules]]) |
| Permissions | declared by the service, evaluated by auth-service | its own roles and permissions (`apps/server/src/routes/roles.ts`, `users.ts`) |
| Login page, administration | admin-ui | in its own SPA, with Setup (`apps/server/src/routes/setup.ts`) |
| Product screens | a static product app | the SPA is served by the server (`@fastify/static`) and wrapped by the desktop shell ([[desktop-shell-tauri]]) |
| Data from another service | the backbone, never a REST call at run time | the server calls the vision service over HTTP (`apps/server/src/vision-client.ts`); the review outbox posts over HTTP (`apps/server/src/modules/carwash/review-outbox.ts`) |
| Live updates to browsers | websocket-service | its own socket, `/api/ws` (`apps/server/src/routes/ws.ts`, [[booth-console]]) |
| Device protocols | adapters that publish canonical events | drivers inside the server process (`packages/devices/`), and device pushes received by the server (`apps/server/src/routes/hikvision-alarm.ts`, `qr-reader.ts`) |
| Streams, buckets, consumers | the nats repo, as config | none |
| Shared schemas and guards | eda-libs (`@eda/*`) | `packages/shared/` |
| Build and deploy | Gitea CI builds, Komodo deploys | already so (`komodo/resources.toml`, [[fleet-deployment-komodo]], [[container-deployment]]) |
**Technologies the guideline requires, against the repository's own guide (`CLAUDE.md`):**
| Guideline | This repository | |
|---|---|---|
| NestJS on Fastify | plain Fastify | differs |
| Its own PostgreSQL through Drizzle | SQLite through Drizzle; PostgreSQL a deferred sync target | differs |
| A static app on nginx | the SPA served by Fastify | differs |
| No user table and no login route in the service | local login, "no external identity provider" ([[offline-first]]) | collides |
| No socket of its own to browsers | `/api/ws` to the booth screen | collides |
| NATS JetStream between services | direct calls; a broker was skipped in 2026-06 ([[dingtian-vs-mqtt]]) | collides for the path that opens the barrier |
| A wiki in the repository, Komodo, Gitea | present | matches |
| Agents push `dev` only; branches `dev` → `stage` → `main` | the three branches exist; work here has gone to `stage` | differs |
None of these is resolved here. The repository's guide binds until the user changes it.
**What the guideline does not answer:**
- Video. It has no word on streams, pictures or a live picture; how the booth screen gets its
picture stays open.
- Device logins. It covers a service's own NATS key, not the logins of cameras, relays or
readers.
- A booth screen that has to work while the link is down. It places screens and browser push on
the hub side and lists the offline operator login as not decided. [[offline-first]] needs the
booth to work with no link at all.
- The signed ledger and its single signer. Not a subject of the guideline; the platform wiki's
parking query treats it.
**Steps that are not in this repository.** The guideline's first steps are an accepted
cross-service decision, a row in the platform's service registry, backbone access and a key.
They are made in the platform wiki and the nats repository.
## What stays whatever the shape
From the repository's guide, and not put in question by the user: [[offline-first]], the signed
append-only ledger ([[append-only-event-chain]]), [[barrier-not-a-door]], [[fail-state-safety]],
and the licence rule of [[standing-decisions]].
## Evidence so far
The H.264 test on park-lab ([[zone-anpr-poc]], "H.264 instead of MJPEG"): the vision side
decoding H.264 sub-streams costs the same CPU as MJPEG and an eighth of the network; the live
picture arrives 0.12–0.24 s behind the camera with one decode thread; the stream held for a
morning with no decode error.
+8 -1
View File
@@ -2,7 +2,7 @@
type: decision type: decision
tags: [parking, decisions, open] tags: [parking, decisions, open]
sources: [parking-system-architecture] sources: [parking-system-architecture]
updated: 2026-11-22 updated: 2026-11-23
status: open status: open
--- ---
@@ -196,6 +196,13 @@ procurement. (See [[parking-system-architecture]] §10.)
detector did not hold on a wet night. Still undecided: what a car lost inside the zone does, and the bench tests of the detector did not hold on a wet night. Still undecided: what a car lost inside the zone does, and the bench tests of the
barrier's own safety. The open work is on [[vision-hardening]], deferred.)_ barrier's own safety. The open work is on [[vision-hardening]], deferred.)_
21. **Event-driven refactor of the repository.** _(Decided by the user, 2026-11-23; the shape is
open.)_ The whole repository is to be refactored along an event-driven pattern, with a bus
between the vision side, the server and the booth screen, and no video or image work in the
server. Waiting for the user's instructions and guidelines document. Not decided: which bus
and its relation to the platform, the events, how the booth gets its picture, how the vision
side gets the camera logins, the watchdog. All on [[event-driven-refactor]].
## Cloud takeover mode vs. the signed ledger (2026-10-22, parked) ## Cloud takeover mode vs. the signed ledger (2026-10-22, parked)
If the cloud commands the barrier while the booth PC is dead ([[relay-proxy-firmware]]), entry/exit If the cloud commands the barrier while the booth PC is dead ([[relay-proxy-firmware]]), entry/exit
+11 -1
View File
@@ -2,7 +2,7 @@
type: decision type: decision
tags: [parking, decisions] tags: [parking, decisions]
sources: [parking-system-architecture] sources: [parking-system-architecture]
updated: 2026-06-21 updated: 2026-11-23
status: settled status: settled
--- ---
@@ -45,6 +45,16 @@ The decisions treated as settled in the design notes. (See [[parking-system-arch
Unsettled items live in [[open-questions]]. Unsettled items live in [[open-questions]].
## The server holds no video or image work; a camera is one signal among several (2026-11-23)
Decided by the user. The vision side talks to the cameras, decodes whatever they send, and
produces what the rest needs. The server is agnostic about the camera side: if a signal comes
from a camera, good; if not, an RF card, a barcode or a push-button ticket does the job, and the
server does nothing special when a camera is blind or dead. Monitoring shows what is down and
the operator raises the issue. A bus connects the vision side, the server and the booth screen.
This comes with a refactor of the whole repository along an event-driven pattern, whose shape
waits for the user's guidelines: [[event-driven-refactor]]. Not built.
## No custom firmware on the Dingtian relay (2026-10-23) ## No custom firmware on the Dingtian relay (2026-10-23)
The [[dingtian-relay]] stays stock. The vendor locks the standard SKU, the bench unit was never The [[dingtian-relay]] stays stock. The vendor locks the standard SKU, the bench unit was never
+7 -1
View File
@@ -2,7 +2,7 @@
type: decision type: decision
tags: [parking, decisions, vision, anpr, anti-fraud] tags: [parking, decisions, vision, anpr, anti-fraud]
sources: [] sources: []
updated: 2026-06-15 updated: 2026-11-23
status: open status: open
--- ---
@@ -10,6 +10,12 @@ status: open
Taken 2026-06-15, as part of the business-layer build ([[session-model]]). Taken 2026-06-15, as part of the business-layer build ([[session-model]]).
> **2026-11-23:** decision 3 below (the Node backend calls the service over localhost HTTP, with
> pictures the camera driver pulled) is to be replaced: the user decided that the server holds no
> video or image work and that the vision side talks to the cameras
> ([[event-driven-refactor]]). Not built; the page describes what runs today. The fallback to
> the ticket path when the service is unavailable stays as it is.
## Decisions ## Decisions
1. **Build a host-side vision service** ([[opencv-anpr-service]]) that does ANPR (plate → identity) 1. **Build a host-side vision service** ([[opencv-anpr-service]]) that does ANPR (plate → identity)
+4 -1
View File
@@ -2,11 +2,14 @@
type: entity type: entity
tags: [parking, stack, auth, offline-first] tags: [parking, stack, auth, offline-first]
sources: [parking-system-architecture] sources: [parking-system-architecture]
updated: 2026-06-15 updated: 2026-11-23
--- ---
# Local JWT Auth # Local JWT Auth
> **2026-11-23:** the new booth of the [[event-driven-refactor]] gets a different scheme, modelled on
> [[booth-users-and-permissions]]. This page describes what runs today and at the running parks.
Authentication and authorization, kept **fully local** — a direct consequence of Authentication and authorization, kept **fully local** — a direct consequence of
[[offline-first]] (an air-gapped park cannot reach an external identity provider; see [[offline-first]] (an air-gapped park cannot reach an external identity provider; see
[[logto-zitadel-oidc]] for the rejected alternative). (See [[parking-system-architecture]] §2.) [[logto-zitadel-oidc]] for the rejected alternative). (See [[parking-system-architecture]] §2.)
+4 -2
View File
@@ -1,13 +1,13 @@
--- ---
type: overview type: overview
tags: [parking, index] tags: [parking, index]
updated: 2026-10-22 updated: 2026-11-23
--- ---
# Index # Index
Content catalog for the wiki. Start at [[overview]]. Maintained on every ingest. Content catalog for the wiki. Start at [[overview]]. Maintained on every ingest.
Counts: 4 sources · 19 entities · 47 concepts · 9 decision records. Counts: 7 sources · 28 entities · 68 concepts · 24 decision records.
## Overview & navigation ## Overview & navigation
- [[overview]] — the top-level synthesis and entry point. - [[overview]] — the top-level synthesis and entry point.
@@ -153,6 +153,8 @@ Counts: 4 sources · 19 entities · 47 concepts · 9 decision records.
- [[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. - [[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. - [[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.
- [[camera-live-view]] — BUILT 2026-11-17: booth camera tiles from the device footer — latest snapshot at rest, live video while that camera sees a vehicle; sub-stream MJPEG over RTSP, reassembled in-process (RFC 2435), one shared session per camera, latest-frame WS delivery; open tiles a user preference; large view with Live/Snapshot; 1280×720, no fps cap. Measured: ~0.1 s delay on the LAN, no extra ANPR 503s. - [[camera-live-view]] — BUILT 2026-11-17: booth camera tiles from the device footer — latest snapshot at rest, live video while that camera sees a vehicle; sub-stream MJPEG over RTSP, reassembled in-process (RFC 2435), one shared session per camera, latest-frame WS delivery; open tiles a user preference; large view with Live/Snapshot; 1280×720, no fps cap. Measured: ~0.1 s delay on the LAN, no extra ANPR 503s.
- [[booth-users-and-permissions]] — 🟡 OPEN (2026-11-23): users and permissions for the new booth — identity has its home in the platform and the booth is in constant two-way sync, local login from the copy, two product keys (`auth`, `parking`), 37 proposed keys, all 44 of today's permissions mapped, two jobs, the rules, signing with a key pair, what the platform needs, what is left to the sync design. Nothing built.
- [[event-driven-refactor]] — 🟡 OPEN (user, 2026-11-23): the whole repository is to be refactored along an event-driven pattern — a bus between vision, server and booth screen, no video/image work in the server, the camera as one signal among several. Waits for the user's guidelines; lists what it touches in today's code and where it meets what is built.
- [[event-streams-split]] — split the signed business ledger (ledger_events) from unsigned device telemetry (device_events). - [[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). - [[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).
- [[party-ledger]] — 🟡 DESIGN (2026-09-08, not built): counterparty sub-ledger for who-owes-whom across modules — parties + signed `charge` / settlement / `write_off` events, balance derived never stored, aging + statements + CSV; lands postpaid subscriptions, hotel guest-nights, fleet washes on account, supplier/utility bills. Sub-ledger only: no bookkeeping, statements are not fiscal invoices, parties per appliance. - [[party-ledger]] — 🟡 DESIGN (2026-09-08, not built): counterparty sub-ledger for who-owes-whom across modules — parties + signed `charge` / settlement / `write_off` events, balance derived never stored, aging + statements + CSV; lands postpaid subscriptions, hotel guest-nights, fleet washes on account, supplier/utility bills. Sub-ledger only: no bookkeeping, statements are not fiscal invoices, parties per appliance.
+192
View File
@@ -4007,3 +4007,195 @@ the staff's remote control, because the system is not ready to control it yet. D
stopped `zg2` on park-lab, with all four relays read off first. The parking server and vision stopped `zg2` on park-lab, with all four relays read off first. The parking server and vision
containers on park-lab were left running. Recorded on [[zone-anpr-poc]] and [[vision-hardening]]. containers on park-lab were left running. Recorded on [[zone-anpr-poc]] and [[vision-hardening]].
## [2026-11-23] query | Passage confirmation — the PoC of 2026-11-22 is the reference
The user, while discussing how to bring the PoC's ideas into the vision service: the PoC as it ran
on 2026-11-22 met the requirements; the staged phase-1 order of 2026-11-19 is not to be cited as
binding any more. Marked as superseded on [[passage-confirmation]]. Still under discussion, nothing
decided: which process owns the camera streams (the user: the server should hold no video or
image work).
## [2026-11-23] query | H.264 instead of MJPEG — decoding test with the zone PoC
The user: the server should hold no video or image work; test H.264 with the PoC and watch the
booth PC's load. Ran a relay-less copy (`zg-h264`) on park-lab, added a live picture to the PoC's
page, measured MJPEG, then switched channel 102 on both cameras to H.264 and measured again: 0.40
against 0.41 cores, 15.2 against 1.85 Mbps. Recorded on [[zone-anpr-poc]]; the user's positions
(no video in the server, a watchdog for crashed services, an event-driven architecture to be
planned) on [[passage-confirmation]]; the side effect on the booth tiles on [[camera-live-view]].
The cameras are left on H.264 and the test copy is left running.
## [2026-11-23] query | H.264 test — delay from camera to live picture
Measured the delay of the PoC's live picture on H.264: 0.5 s (entry) and 0.4 s (exit) with the
decoder's default threads, 0.12–0.24 s and 0.18 s with one decode thread, against 0.09–0.10 s for
MJPEG. Cause: one frame held back per extra decode thread. Added `decode_threads` to the PoC. The
user's own load readings, watching and not watching, are on [[zone-anpr-poc]] with the rest.
## [2026-11-23] query | H.264 test — a car in the zone
Two approach-and-reverse visits on H.264 (07:32 UTC): both judged abandoned, the plate decided in
0.34 s in the first; in the second the camera's on-screen label "Hyrje" was read as a plate and
one still voted for it. Video-frame reads at 65–90 px were 4 of 4 right, as with MJPEG. Recorded
on [[zone-anpr-poc]]; the label misread added to [[vision-hardening]].
## [2026-11-23] query | H.264 test — staff traffic
Eight visits by the staff on the relay-less test copy (07:52–09:11 UTC), read from the frames:
the entry camera judged 3 of 3 as passed, among them a car pushed through by five people; no
plate was decided in any visit, and the records neither blame nor clear H.264 (the plates were
under the size gate or too soft). A tall vehicle's box reached the moved label and it was not
read. The still pause carried over from one car to the next (review finding 14). The stream held
with no decode error. Recorded on [[zone-anpr-poc]], [[vision-hardening]] and
[[zone-anpr-poc-review]].
## [2026-11-23] query | H.264 test — bad weather, test copy left running
The user: the morning's results have to be read with the bad weather in mind (outdoor cameras,
the weather cannot be fixed); the relay-less test copy `zg-h264` stays running. Noted on
[[zone-anpr-poc]] and [[vision-hardening]].
## [2026-11-23] query | Event-driven refactor — the user's decisions recorded
The user: plate reading from H.264 will be handled; the server is agnostic about the camera side
(no signal from a camera, then a card, a barcode or a push-button ticket does the job; monitoring
shows what is down and the operator raises it); viewing from outside is out for now; the whole
repository is to be refactored along an event-driven pattern, with a bus between the vision side,
the server and the booth screen; instructions and a guidelines document will follow. New page
[[event-driven-refactor]] (decided, not decided, what it touches in the code, where it meets what
is built). Pointers added on [[passage-confirmation]], [[vision-service]], [[camera-live-view]],
[[lane-presence-and-anpr-entry]], [[dingtian-vs-mqtt]], [[entry-double-press]],
[[operator-issued-entry]], [[entry-presence-bypass]], [[standing-decisions]], [[open-questions]],
[[overview]]. Found while recording: the camera gates the entry button today, which the
agnostic-server rule does not match; left for the user. Nothing built, nothing committed.
## [2026-11-23] query | Event-driven refactor — the camera gate and the blinded camera settled
The user: the bypass for camera and radar events is the unblocking mechanism and is in place, so
the camera gate on the entry button stays; a camera that is healthy but blinded is an operational
matter of the business, not the system's concern. The two points are marked settled on
[[event-driven-refactor]]; the notes on [[entry-double-press]], [[operator-issued-entry]] and
[[entry-presence-bypass]] say so.
## [2026-11-23] query | Event-driven refactor — the guideline read against the repository
The user handed over `EDA/wiki/guideline-joining-the-platform.md`. Read against this repository
and recorded on [[event-driven-refactor]]: its Rule 1 row by row against what the code does
today, the required technologies against the repository's guide, what the guideline does not
answer (video, device logins, a booth screen with no link, the ledger's signer), and which of its
steps lie outside this repository. Whether parking joins the platform as a leaf is on the
guideline's own "Not decided" list. Nothing designed, nothing built.
## [2026-11-23] query | Event-driven refactor — scope, and the Rust question
The user: a multi-tenant core for all future parks that only shows synced records; park-buzi and
park-2 stay out for now and migrate later; the park is offline-first and the leaf lives without
the core; the guideline binds only the structure of users and permissions. Asked, not decided:
drop Docker on the leaf and rebuild every service in Rust, starting with users and permissions.
Measured park-lab's memory and disk per service and sized the code; on [[event-driven-refactor]].
## [2026-11-23] query | Event-driven refactor — built on branch `eda_dev`, parallel to the existing code
The user: whichever language, the work goes to another branch (`eda_dev`) and is built beside the
existing code in new directories (examples: `apps/web_new`, `apps/server_new`). Branch created
from `stage`; nothing pushed. Noted on [[event-driven-refactor]] with what the branch does and
does not trigger.
## [2026-11-23] query | Event-driven refactor — users and permissions as the first piece
Names agreed: `apps/booth` and `apps/core`. The user: start with users and permissions (the old
ones are sloppy); username login with email optional; the booth is the only signer, the core
syncs, reads and monitors, and a booth is recovered from the core; the platform admin manages
tenants and subscriptions only; a tenant admin can have many parks. The levels are not settled;
the assistant's three-ring proposal is recorded as a proposal on [[event-driven-refactor]].
## [2026-11-23] query | Users and permissions for the new booth — the model
The user confirmed the three rings and asked for the model page. New page
[[booth-users-and-permissions]]: what is kept from today's scheme (login until logout, the
never-locked-out admin, no grant beyond your own, jobs applied by an admin, per-desk money
guards, the filtered feed), what the code shows as wrong, the model (users, members, policies
with scope, several per member, opaque sessions), a proposed catalogue of 45 keys in four
products, all 44 of today's permissions mapped (checked by script against `PERMISSIONS`), the
four jobs re-expressed, the rules, what reaches the core (proposed), where the booth differs
from the platform, ten open points. Rings moved to "decided" on [[event-driven-refactor]].
Nothing built, nothing committed.
## [2026-11-23] query | Booth users and permissions — validation and car wash out; changes from the core
The user, after reading [[booth-users-and-permissions]]: validation and the car wash are to be
separate services with their own permission sets, so their keys leave the booth's catalogue,
and the jobs Merchant and Wash operator are removed. The catalogue is now 35 keys in two
products (`site`, `parking`); the 44 permissions of today are still each mapped, those of the
two services as "leaves" (checked by script). The second reversal of 2026-09-05 (a copy of
shift and drawer keys per module) no longer arises. The user also asked whether one
cryptography can sign the ledger whatever the origin, with the case of a tenant admin creating
a booth admin from a phone while the park may be offline. Recorded as raised and proposed, not
decided: a key pair per origin, a signed command from the core, the booth as the only writer of
its chain, and four points open within it (whose key signs for the person, which changes may
start at the core, the first password, the algorithm). Noted on [[event-driven-refactor]].
## [2026-11-23] query | Booth users and permissions — changes from the core decided
The user ruled on the four points of "Changes that start at the core" on
[[booth-users-and-permissions]]: the core's key signs for the tenant admin; only users and
grants may be changed from the core; the first password is a one-time code; P-256 for ledger
entries on both sides. Section moved from proposed to decided. It follows that user changes
made at the booth are ledger entries too. Still open: the code's validity, a command whose
target changed while offline, the no-grant-beyond-your-own rule for a tenant admin, lockout
with the link down. Hub page [[event-driven-refactor]] updated.
## [2026-11-23] query | Booth users and permissions — three more rulings on commands from the core
The user: a one-time code is valid 24 hours from issue; no command is issued while the booth is
offline (disabled buttons and a visible note on the core); "no grant beyond your own" holds for
the tenant admin. Recorded on [[booth-users-and-permissions]] as rulings 5–7; the walk-through
there no longer has a command waiting for an offline park. Open: what "your own" means across
the two catalogues, a command sent as the link drops, how the core knows a booth is online. The
lockout point was not understood as written and is to be explained again.
## [2026-11-23] query | Booth users and permissions — no lockout, tenant admin as owner
The user: no account is locked for wrong passwords at a booth; a forgotten admin password with
the link down is solved by bringing the link up (a personal phone's hotspot) or waiting, then a
reset from the core; a tenant admin counts as holding everything on their parks ("the tenant
admin is the owner"). Recorded on [[booth-users-and-permissions]] as rule 12 and rulings 8–9.
A growing wait between wrong tries is proposed with the no-lock rule and not confirmed.
## [2026-11-23] query | Booth users and permissions — scoped strings, 12 characters, B2B postponed
The user: scope in the permission string is taken (it reverses the 2026-09-05 rejection, with
the scope now meaning ownership); a password has at least 12 characters; validation and the
car wash will connect to each other and to parking as business to business, postponed, not to
be raised again; separate services are built if need be (car wash, hotels, cafés). Recorded on
[[booth-users-and-permissions]] and [[event-driven-refactor]]. The product key `site` was not
understood as asked and is to be explained again.
## [2026-11-23] query | Booth users and permissions — one product key, `parking`
Asked whether to keep a second product key `site` for what is not parking as a business, the
user answered "parking.payment:take. This format". Read as: one product key, `parking`, for
every key of the booth. The 17 `site.*` keys were renamed to `parking.*` on
[[booth-users-and-permissions]] (35 keys, one product, no clash; mapping and jobs re-checked by
script). Consequence noted under entitlements: switching `parking` off would also stop user
management, backup and the ledger view unless those keys are excepted.
## [2026-11-23] query | Booth users and permissions — users and grants under `auth`
The user showed the platform's admin console (tenant policies `auth-admin`, `gps-admin`) to
make clear what a product key is, and ruled: the booth's user and policy keys move to `auth`,
by the separation of concerns already on [[event-driven-refactor]] (Rule 1). The earlier
reading "one product key, `parking`" was wrong and is replaced. On
[[booth-users-and-permissions]]: `auth.user:read|manage`, `auth.member:read|manage`,
`auth.policy:read|manage` with the platform's names (`auth.user:manage` is the booth's own, the
platform leaves it out on purpose); 31 keys stay under `parking`; 37 in all, mapping and jobs
re-checked by script. `auth` is always on, as on the platform.
## [2026-11-23] query | Booth users and permissions — home on the platform
The user, on the booth-only key `auth.user:manage`: "Why we leave the auth out of the platform?
Everything should be in the platform. This, as leaf service will sync everything with the
platform." Recorded as a change of direction at the top of [[booth-users-and-permissions]] and
on [[event-driven-refactor]]: identity has its home in the platform's auth service, the booth
holds a synced copy. The page's sections that place accounts on the booth only are marked as
not yet reworked. Four hinge points proposed: no user or policy change at the booth; password
hashes reach the booth; who creates a park's operators on the platform; what the rulings on
commands from the core become.
## [2026-11-23] query | Booth users and permissions — reworked for constant sync
The user: login at the booth is local, with a cookie for the local domain or IP; users and
policies can be changed at the booth whenever, by whoever holds the right, link or not;
everything is in constant sync, which is the purpose of the leaf; a park's operators are
created by whoever holds the right; and no more questions on changes from the core.
[[booth-users-and-permissions]] rebuilt: "Where identity lives" and "The people" replace the
three rings and the commands from the core; a table lists each earlier ruling of the day as
replaced or standing; "What the platform needs for this" (username login, `auth.user:manage`,
a leaf holding identity and hashes, changes taken in from a leaf, the `parking` catalogue);
ten technical points are left to the design of the sync with a default each, not to be put to
the user again. Catalogue, mapping, jobs and rules unchanged (37 keys, checked by script).
[[event-driven-refactor]] and the index updated.
## [2026-11-23] query | Event-driven refactor — TypeScript with Docker; Rust abandoned
The user: "TypeScript with Docker I guess. I abandoned the idea of Rust." Recorded on
[[event-driven-refactor]]; the park-lab measurements taken for the Rust question stay as a
record. Komodo and the compose-delivered leaf are kept.
+6 -1
View File
@@ -2,7 +2,7 @@
type: overview type: overview
tags: [parking, overview, synthesis] tags: [parking, overview, synthesis]
sources: [parking-system-architecture] sources: [parking-system-architecture]
updated: 2026-11-22 updated: 2026-11-23
--- ---
# Parking System — Overview # Parking System — Overview
@@ -47,6 +47,11 @@ deployed on-site at a parking facility. Two forces shape nearly every decision:
6 [[open-questions]] still drive procurement — most critically **lane topology**, **failure 6 [[open-questions]] still drive procurement — most critically **lane topology**, **failure
modes (fail-open on exit)**, the **reconciliation channel**, and **backup/durability**. modes (fail-open on exit)**, the **reconciliation channel**, and **backup/durability**.
**Refactor ahead (user, 2026-11-23):** the repository is to be refactored as a whole along an
event-driven pattern: a bus between the vision side, the server and the booth screen, no video
or image work in the server, and the camera as one signal among several. Its shape waits for the
user's guidelines; nothing is built. See [[event-driven-refactor]].
## Reading paths ## Reading paths
- *Security-first:* [[threat-model]] → [[append-only-event-chain]] → [[reconciliation]] → - *Security-first:* [[threat-model]] → [[append-only-event-chain]] → [[reconciliation]] →