9332802e5d
One pulse path, pulseBarrier (relay-pulse.ts), for all six callers: entry button/operator mint, reader and booth exits, subscription opens, manual (forgiven) exits and the setup relay test. Each pulse writes an info line naming relay, controller, direction, identity and operator, and inserts a device_events row of kind "relay" for success and failure alike; failures are still re-thrown so each flow keeps its own anomaly handling. Prompted by the 2026-10-09 park-2 "barrier opened by itself" claim: the ledger showed the why, but nothing recorded the moment a relay was actually driven. The signed ledger stays the authority; this is unsigned telemetry. Also git-ignores tmp/ (site snapshots pulled for incident review).
57 lines
2.9 KiB
Markdown
57 lines
2.9 KiB
Markdown
---
|
|
type: concept
|
|
tags: [parking, devices, monitoring, telemetry]
|
|
sources: []
|
|
updated: 2026-06-15
|
|
status: open
|
|
---
|
|
|
|
# Device Events (telemetry)
|
|
|
|
The **unsigned** operational record of what the hardware did and reported — distinct from the
|
|
signed business [[append-only-event-chain|ledger]] (see [[event-streams-split]]). For monitoring,
|
|
diagnostics, and live booth status — **not** anti-fraud.
|
|
|
|
## What lands here
|
|
|
|
- **Relays/barriers:** every `pulseOpen` issued from business logic — kind `relay`, detail
|
|
`{driverId, relay, direction, identity, source, operator?, ok, error?, tookMs}` — success **and**
|
|
failure, written by `apps/server/src/relay-pulse.ts` (`pulseBarrier`, the ONE pulse path: entry
|
|
button/operator mint, reader + booth exits, subscription opens, manual exits, the setup relay
|
|
test). Also an info log line `relay pulse: exit relay 2 on dingtian <id> ← booth <identity> by
|
|
<operator>`. The *device-side* echo; the authoritative record of WHY is the signed ledger event
|
|
appended before the pulse. Built 2026-10-09 after a park-2 "barrier opened by itself" claim took
|
|
ledger + snapshots to settle because pulses were only logged when they *failed*.
|
|
- **Printers:** paper-out / near-end / cover-open / cutter / offline (already polled —
|
|
[[printer-status-monitoring]]).
|
|
- **Cameras:** reachable/offline, snapshot success/failure ([[lpr-camera]]).
|
|
- **Readers / inputs:** a raw read, raw input edges (Dingtian button `input N on/off` —
|
|
[[device-input-flow]]).
|
|
|
|
## Properties
|
|
|
|
- **Unsigned, not chained** — no `prevHash`/`signature`. It's telemetry, so it carries none of the
|
|
ledger's integrity machinery.
|
|
- **Disposable** — high-volume and churny; **may rotate/prune** on a retention policy (the ledger
|
|
never does).
|
|
- **Device-keyed** — references the `devices` instance (raw device provenance). No `lane`
|
|
(pool-of-spaces model — see [[entry-exit-points]]).
|
|
|
|
> **Not to be confused with [[app-logs]].** `device_events` is **hardware telemetry** (a relay fired,
|
|
> a camera failed). Diagnostic/application logs (a failed API request, an uncaught frontend error,
|
|
> a backend warning) are a **separate third stream** in `app_logs` — don't route app errors here, nor
|
|
> hardware telemetry there. Both are unsigned + prunable; the distinction is *what produced it*.
|
|
|
|
## The boundary that matters
|
|
|
|
A device event is *evidence the host saw something happen*; it does **not** by itself authorize or
|
|
record a business fact. A button press here becomes a **signed `vehicle_entry`** in the ledger only
|
|
after the entry flow runs (ticket + barrier command). This keeps device chatter on the device side
|
|
of the [[device-adapter-pattern|adapter boundary]] and the signed ledger focused on money/access.
|
|
|
|
## Open
|
|
|
|
- Retention/rotation policy (size- or age-based).
|
|
- Whether any witness-grade device fact (e.g. a loop-sensor `barrier_open_observed`) should *also*
|
|
write a signed ledger entry for [[reconciliation]] — see [[append-only-event-chain]].
|