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
This commit is contained in:
2026-11-23 12:02:18 +01:00
parent 980a3e5178
commit dd2dd53d7e
17 changed files with 478 additions and 21 deletions
+11 -1
View File
@@ -2,7 +2,7 @@
type: decision
tags: [parking, camera, ui, booth, video, hikvision]
sources: []
updated: 2026-11-17
updated: 2026-11-23
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
(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)
- 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
`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)
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
tags: [parking, decision, devices, transport]
sources: []
updated: 2026-06-15
updated: 2026-11-23
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
with the [[autonomous-direction|unmanned]] roadmap at multi-lane scale — re-evaluate then. Until
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.
+107
View File
@@ -0,0 +1,107 @@
---
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 will provide the instructions and a guidelines document.
**Nothing is designed or built until that document arrives.** This page holds what is decided,
what is not, and what the decisions touch in the code as it stands.
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
- **Which bus, and how it relates to the platform.** Suggested by the assistant and not
confirmed by the user: the buffered NATS leaf on the booth PC that the platform wiki describes
for syncing the ledger (`EDA/wiki/queries/q-parking-core-service-on-the-platform.md`, deferred
by the user on 2026-10-20) could also be this local bus.
- 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.
## 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
tags: [parking, decisions, open]
sources: [parking-system-architecture]
updated: 2026-11-22
updated: 2026-11-23
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
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)
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
tags: [parking, decisions]
sources: [parking-system-architecture]
updated: 2026-06-21
updated: 2026-11-23
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]].
## 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)
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
tags: [parking, decisions, vision, anpr, anti-fraud]
sources: []
updated: 2026-06-15
updated: 2026-11-23
status: open
---
@@ -10,6 +10,12 @@ status: open
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
1. **Build a host-side vision service** ([[opencv-anpr-service]]) that does ANPR (plate → identity)