feat(server): log every relay pulse and echo it to device_events (kind relay)
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).
This commit is contained in:
@@ -14,8 +14,14 @@ diagnostics, and live booth status — **not** anti-fraud.
|
||||
|
||||
## What lands here
|
||||
|
||||
- **Relays/barriers:** relay fired/released, pulseOpen issued (the *device-side* echo; the
|
||||
authoritative `barrier_open_command` is a signed ledger event).
|
||||
- **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]]).
|
||||
|
||||
Reference in New Issue
Block a user