Commit Graph
9 Commits
Author SHA1 Message Date
Admin 6873b1a3f1 [chore](alarm): ignore test logs from every source package
Tests run with their package directory as cwd, so any package can drop a logs/ directory. The per-package list kept going stale; match src/**/logs instead.
2026-10-19 02:28:59 +01:00
Admin 55e83d6bfd [feat](alarm): hash client identifiers in stdout request logs
A request log should not name a client directly, and the durable event log deliberately has no network columns. Hash the IP and user agent with internal/loghash for the stdout line; empty values stay empty rather than logging a constant digest. This is record anonymisation, not cryptographic protection, and the package says so.
2026-10-19 02:28:59 +01:00
Admin 028f9e7dae [refactor](alarm): make a readable message structural on every error
An error status with an empty body is a client-breaking bug that review does not reliably catch. Route every JSON and plain-text error through internal/apierr, which substitutes the code canonical message when a caller supplies none, and keep the frozen codes in one package shared by the action and WebSocket layers.
2026-10-19 02:26:46 +01:00
Admin 3ccea3e9f6 [feat](alarm): keep one anonymised lifecycle event log
Record created/joined/triggered/delivered/destroyed with SHA-256 hashes of the alert and user UUIDs only, and a reason on destruction. The earlier analytics and stdout-mirror tables were superseded by the user ruling, so 009 creates alarm.event_log, migrates what still applies and drops both, leaving exactly one durable table with no network identifiers, token, body or query string. Retention is age-based via the sweeper.
2026-10-19 02:26:46 +01:00
Admin 6e6a1e9c8a [feat](alarm): add a durable per-device delivery ledger
pg_notify and the socket fan-out are not durable, so an offline phone used to miss a trigger forever and no-auto-stop would leave it ringing at nobody. Write one ledger row per enabled subscription in the trigger transaction, replay what a subscription still owes on every socket connect, and clear a row only on an explicit ack (live socket ack or ackAlarm); alarmStatus is a read-only check-in that answers 409 ERR_ALARM_TRIGGERED_OFFLINE with the missed frame. Ack is idempotent, and a destroyed alert cascades its debt away so a client is never told it missed an alarm that no longer exists.
2026-10-19 02:26:46 +01:00
Admin 0334d7fe93 [feat](alarm): store device ids as sha256 digests
device_id is a stable pseudonymous idempotency key, not a credential; a database dump should not be a usable list of device identifiers. Hash every caller-supplied value before it reaches the table, keep raw values out of logs and subscription views, and migrate existing rows with the identical SQL encoding.
2026-10-19 02:26:31 +01:00
Admin 3a2da52b7a [refactor](alarm): end alerts by disarm or expiry, not a ring timer
An alert now rings from trigger until the owner disarms it; a subscriber silences only its own device. The owner instead sets a persistence cap (default 24h, hard cap 14 days) and the sweeper destroys expired alerts. Disarm ends an armed alert too, and every ending (delivered, expired, disarmed, deleted) converges on the one destruction path so their event-log reasons cannot drift.
2026-10-19 02:26:31 +01:00
Admin f055700c2d [refactor](alarm): retire subscribe-token rotation
The subscribe token is minted once per alert and lives as long as it does; subscribers are never evicted, so the rotation counter had no reader. Drop token_version from the schema and stop serialising tokenVersion on the wire. The QR payload is now built from alert id + token only, which also makes it instance-relative.
2026-10-19 02:26:31 +01:00
Admin ec38e680d6 init 2026-10-18 22:31:16 +01:00